Forum
Unexpected token 'NEXT' - 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: Unexpected token 'NEXT' (/showthread.php?tid=734)



Unexpected token 'NEXT' - gunduzs - 05-23-2016

Hello,

this is my 1st post! Total newbie.

I just typed in the 1st program in the book "ZX Spectrum Games Code Club: Twenty fun games to code and learn" by Gary Plowman (from Amazon),
but when I attempt a "zxb ex1.bas" , it throws up a couple of errors.
I've checked the code and it appears valid. Any ideas on what the problem could be?

(I've attached the .bas file)

Regards


Re: Unexpected token 'NEXT' - boriel - 05-31-2016

Yes, the problem (despite this weird error) is not with the FOR, but with the IF.
Unlike Sinclair BASIC, ZX BASIC requires each IF to be closed with an END IF.
So after every IF line, in the end, add :END IF and compile it.

Try it, and tell me.