PDA

View Full Version : labels in 5.0


rhosk
11-13-2003, 09:31 AM
This may be a dumb question, sorry, but how do you return to labels with this new syntax. I'm melding into the changes here slowly, but I can't figure out how to "goto" a label in this thing - don't laugh! 4.0 was so simple comparitively. I'm sure it's a quick easy answer, but would you please enlighten? Thanks much.

TJ_Tigger
11-13-2003, 11:50 AM
The language that IR used in AMS 5.0 does not have a native goto (unconditional jump) function that I am aware of. Nor does it have a RETURN function. The term RETURN is part of the programming language but not used in the same way. What I have been doing to get around this is to nest IF statements. It takes a little for me to think it out but it works quite well.

If there is a way to apply GOTO statements and Lables or the RETURN break let me know.

Lorne
11-13-2003, 02:07 PM
There's a trick you can do to break from an event: the break command is only allowed within a loop. So, just turn your whole event into a 1-step loop, and you have instant breakability.

Like so:


do

-- bunch of stuff goes here

if bTest == TRUE then
break;
end

-- more stuff here

until true

Brett
11-13-2003, 02:10 PM
Another method is to use a function and then just do a return when you want to break out:


-- Define a worker function
function temporary()
-- bunch of stuff goes here

if bTest == TRUE then
return;
end

-- more stuff here
end

-- Now call it
temporary();