Forum
bug on "if", "end if", etc.? - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16)
+---- Thread: bug on "if", "end if", etc.? (/showthread.php?tid=854)



bug on "if", "end if", etc.? - nitrofurano - 09-30-2018

when trying to compile this code on 1.8.8:
Code:
dim i as ubyte
i=3
if i>2 then:
  print "3>2"
  end if
do:loop

i get this error message when compiling
Code:
endifbug.bas:5: Syntax Error. Unexpected token 'IF' <IF>

on other few tests i tried, the same happened on "end if"


RE: bug on "if", "end if", etc.? - boriel - 12-30-2020

Sorry, Nitro, I completely overlooked this post Sad

It turns out you cannot use ":" after then if you want a block-sentence if. The syntax was changed on 1.6.x
":" Colon after then means you have to finish the IF in the same line like in traditional BASIC (so remove it there to allow the program to compile)