RetroBASIC
Retrogamecoding(.org) => EGSL => Topic started by: Peter on November 20, 2012, 09:32:19 PM
-
Hi Cyber,
there is no EXIT FOR, what can I use for it?
-
just use
end
-
Hi cvirus,
No, isn't.
D:\EGSL\julia.lua:24: '<eof>' expected near 'end', is what i got.
I think is rather BREAK, but I'm not sure about BREAK.
-
You should use break and end.
for x = 1, 1000 do
if x > 500 then break end
print(x)
end
Here is an explanation: http://www.lua.org/pil/4.4.html (http://www.lua.org/pil/4.4.html).
-
A simple for loop is like:
for i = 1,3 do print(i) end
The break statement immediately ends the current loop when executed, if you whant to complete the for loop then you shouldn't use break.
for i = 1, 3 do
if ( i == 2 ) then break end
print( i )
end
-
The break statement immediately ends the current loop when executed...
That's exactly what exit for in BASIC does.
-
I think is rather BREAK, but I'm not sure about BREAK.
Yes, it's break. You can see an example in this topic (http://retrogamecoding.org/board/index.php?topic=17.0) :
(...)
for i = 0, 50 do
zre2 = zre*zre
zim2 = zim*zim
if zre2 + zim2 > 4 then
color(255-(i+5), i*5, i)
dot(x,y)
break
end
zim = 2*zre*zim+cim
zre = zre2-zim2+cre
end
(...)
break exits the for-loop (and not the if-block, as we might think)
-
A well done help, inbuilt in EGSL IDE would be more exact.
-
EGSL is Lua, so it's the Lua way. ;D BTW, "break" is a highlighted keyword in the IDE.
-
LOL
-
I think is rather BREAK, but I'm not sure about BREAK.
Yes, it's break. You can see an example in this topic (http://retrogamecoding.org/board/index.php?topic=17.0) :
(...)
for i = 0, 50 do
zre2 = zre*zre
zim2 = zim*zim
if zre2 + zim2 > 4 then
color(255-(i+5), i*5, i)
dot(x,y)
break
end
zim = 2*zre*zim+cim
zre = zre2-zim2+cre
end
(...)
break exits the for-loop (and not the if-block, as we might think)
That´s right, sorry if i wan´t very clear.