-> IF NOT LEN(k$) THEN GOTO Again
Hahahahaha!!! That will get you into all kinds of trouble! It will
*not*, as you are obviously expecting, "GOTO Again" only if LEN(k$) is
zero. What it will do is take LEN(k$), do a Boolean NOT - i.e. invert
all the bits -, and execute the GOTO if the result is non-zero. In fact,
the result of the NOT operation can be zero only if the LEN is -1, which
is impossible. So the above bit of code will *always* execute the GOTO,
irrespective of k$ or its LENgth.
If X is a integer, X and NOT X are *both* regarded as "true" by BASIC
for *all* values of X except 0 and -1. If X is 0, then X is "false", and
if X is -1, NOT X is "false".
Unless you are absolutely *certain* that you aren't going to fall into
this kind of trap, it is far better to spell things out in full:
IF LEN(k$) = 0 THEN GOTO Again
or
IF k$ = "" THEN GOTO Again
Incidentally, in most BASICs, THEN GOTO can be written just as GOTO or
as THEN. I forget whether QB allows this.
dow
--- PCBoard (R) v15.3 (OS/2) 5
---------------
* Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710)
|