It should be noted that comparing against -1 for truth is a bad idea.by John Q. Boolean (no login)
Instead, one should compare to ensure something is not true (i.e. false):
'Open a file and keep reading lines until we exit.
f = FREEFILE
OPEN "filename.txt" FOR INPUT AS #f
WHILE NOT EOF(#f)
LINE INPUT #f, x$
Also, for things like the LEN function that return a non-Boolean value, it makes more sense to test whether something is/isn't a certain length. For example, doing something like WHILE NOT LEN(INKEY$): WEND makes little sense semantically whereas WHILE LEN(INKEY$) = 0: WEND makes more sense. After all, you're testing whether the number of characters in INKEY$ is 0, not whether it is true or false because it doesn't return a true/false value. Of course, you're free to do what you wish as always.
Return to Index
|Response Title||Author and Date|
|...||matt on May 12|
|Re: It should be noted that comparing against -1 for truth is a bad idea.||Michael Calkins on May 12|