BM> FOR test% = 1 TO 3
BM> IF test% = 3 THEN test% = -333: test% = 999
BM> PRINT test%
BM> NEXT test%
Hi Brian, I don't think this is a quirk you found. I believe all
basic's do the exact same thing. The : allows for multiple statements
on same line. In this case it is still executing the code due to the
condition being true, and you have an implied END IF when it reaches
the end of the line.
I for one am glad it works this way, as it doesn't force me into
if/then/end if blocks if I want to execute more than 1 statement if the
condition is true. If they were to change it that would bust pretty
much every program I have ever written. I am thinking perhaps you are
thinking "pascal'ish" or even "c-ish"? If'n remembering correctly
those languages only allow 1 statement after an IF unless you put it in
brackets. Basic doesn't (and I'm glad it doesn't) work this way. That
was one of the things I disliked about pascal and C, well besides the
way C handles CASE statements... Eric
--- QM v1.00
---------------
* Origin: Creekside Manor (805) 484-8016 CdCom Support BBS (1:206/2512.0)
|