If..endif error
Archives Forums/BlitzMax Bug Reports/If..endif error
| ||
The following code generates a Endif without matching if on the endif, surely it should be garbage at end of line on the if statement.If MouseY()ScreenY+32 EndIf Basically its missing the < after MouseY() |
| ||
Nope, because If MouseY() ScreenY+32 is perfectly valid code [edit] It's assumed to be If MouseY() THEN ScreenY+32. When MouseY() is anything other than 0, screenY will be set to 32. The EndIf is redundant. Last edited 2012 |
| ||
Ah I see, im so used to the 'Then' keyword but surely there should be a space in there for it to register :) Last edited 2012 |
| ||
It's assumed to be If MouseY() THEN ScreenY+32. When MouseY() is anything other than 0, screenY will be set to 32. 'Then' isn't needed on single-line If, but this still isn't valid code -- it'd have to be ScreenY=ScreenY+32 or ScreenY:+32: ' Identifier ScreenY not found... If MouseY() Then ScreenY+32 However, in the original example, Max is detecting the non-matching EndIf first (because of the implied Then) and reporting that. |
| ||
but this still isn't valid code -- it'd have to be ScreenY=ScreenY+32 or ScreenY:+32: Oops, my bad. For some reason I read it as ScreenY=+32. |