>There is no such thing as a EOF character real...
# announcements
e
There is no such thing as a EOF character
really sadly
v
This one of those "by definition" things
e
ok, may you advice me, what should I use instead of unexisting ‘eof’ char? I have such code in Python:
Copy code
def advance(self):
        self.pos += 1
        if self.pos > len(self.text) - 1:
            self.current_char = None  # Indicates end of input
        else:
            self.current_char = self.text[self.pos]
if self.current_char is not None ...
and I’m trying to code something like that but in kotlin. I need some special char value (python programmers have None for that case). May be nullable Char?
v
A similar API exists in Java. For example
Reader.read()
returns
-1
when the end of file is reached. See https://stackoverflow.com/questions/811851/how-do-i-read-input-character-by-character-in-java
👍 1
You may be able to find better solutions, like reading a file into a stream of characters