FAQ  •  Register  •  Login

Nexting a For from an IF...THEN

<<

ardentcrest

Posts: 94

Joined: Fri Oct 11, 2013 5:19 pm

Post Tue Feb 17, 2015 1:36 pm

Nexting a For from an IF...THEN

Me again :D

  Code:
2004 for xx=length to 1 step -1
2006   if z$(xx)=" " then next xx


Syntax Error. Unexpected token 'NEXT' <NEXT>



Why are the hard thing easy, and what should be easy hard :P
I'm always on the chat or facebook.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Tue Feb 17, 2015 2:02 pm

Re: Nexting a For from an IF...THEN

ardentcrest wrote:Me again :D

  Code:
2004 for xx=length to 1 step -1
2006   if z$(xx)=" " then next xx


Syntax Error. Unexpected token 'NEXT' <NEXT>



Why are the hard thing easy, and what should be easy hard :P

I've splitted this topic and moved this question into here, since it's more generic to ZX BASIC syntax. Please, post your questions separated, if possible (one in each thread), so other users might find them more useful. :idea:

You can no longer NEXT a for from any point. Instead use CONTINUE FOR to next, or use EXIT FOR to stop the loop:
  Code:
2004 for xx=length to 1 step -1
2006   if z$(xx)=" " then CONTINUE FOR: end if
2010 next xx


Read: http://www.boriel.com/wiki/en/index.php ... C:CONTINUE
<<

ardentcrest

Posts: 94

Joined: Fri Oct 11, 2013 5:19 pm

Post Tue Feb 17, 2015 5:14 pm

Re: Nexting a For from an IF...THEN

boriel wrote:I've splitted this topic and moved this question into here, since it's more generic to ZX BASIC syntax. Please, post your questions separated, if possible (one in each thread), so other users might find them more useful. :idea:


Good Idea.

Get ready for 2 or 3 new threads a day from me. :mrgreen: :mrgreen:
I'm always on the chat or facebook.

Return to Help & Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO