GLBasic forum

Main forum => Bug Reports => Topic started by: FutureCow on 2009-Nov-21

Title: ELSEIF/THEN bug?
Post by: FutureCow on 2009-Nov-21
This may be a bug, but it may be the desired action.

An "IF/THEN" command works, but using a "THEN" command on an "ELSEIF" generates a syntax error. eg.
Code (glbasic) Select
if a=1 THEN b=1
ELSEIF z=2 THEN y=1


Title: Re: ELSEIF/THEN bug?
Post by: MrTAToad on 2009-Nov-21
THEN doesn't work with ELSE either - which, I think is okay : Use IF/THEN for single comparisons and IF/ELSE/ELSEIF/ENDIF for multiple comparison checks
Title: Re: ELSEIF/THEN bug?
Post by: FutureCow on 2009-Nov-21
It's an easy fix to get rid of the THEN on an ELSE/ELSEIF, it just appears that it should work and the error message the compiler gives is not specific about that being the error (e.g. if it said "can't use THEN after ELSE/ELSEIF" instead of "syntax error" that would be a lot more helpful :D )
Title: Re: ELSEIF/THEN bug?
Post by: MrTAToad on 2009-Nov-21
Yes, a more specific error message would be better.