That is the string that gets printed at line 1. Technically, we are not required to retain the returned instream. However, if we do not bind it to some identifier, such as IN here, the token representing the instream is lost forever. A call by howMany to howMany1 with second argument 0 allows the exact number of waiting characters to be determined. The second and subsequent times executed, the value of x is the empty string.
Subsequent calls produce the empty string.
Subsequent calls produce the empty string as the value of x . The following is one possible solution. We have written the code without opening structure TextIO , to give a sample showing that it is possible to do so.