Why is it not “while a == f.getc” ? ( == instead of = )
What does getc here mean anyway? I know it reads a single character,
correct?
a = f.getc assigns to the variable a the next character from the file
f. You need to know also, that f.getc will return nil when the end of
file is reached. The assignment returns the assigned value as the
result of the expression. This code uses this value as the condition
of the while. So it keeps reading a char from the file and assigning
to variable a, until f.getc returns nil, at which point a gets
assigned nil, the expression returns nil, the while condition is not
met and the loop ends.