
-----------------------------------
(-.-)&gt;YoGiBeHR&lt;(-.-
Mon Nov 13, 2006 7:35 pm

Making a FOR loop repeat only once
-----------------------------------
Hello CompSci

I have a main menu, with options: Start, About and Help
When the user clicks START (start is a procedure for the game) the proggie will load the game procedure, and inside that game procedure another procedure for graphics will be loaded inside... 

So , how do I make my for loop play only once please, thank you!

-----------------------------------
Clayton
Mon Nov 13, 2006 7:42 pm


-----------------------------------
some code would be nice to see here, as I don't know why you even have a loop if you only want the code to run once.

However, if you want the code to run only once (for whatever reason you want a loop to run once...), use a for loop:


for Index : 1 .. 1
%code in here
end for


You could also have some sort of boolean flag and run a conditional loop:


var flag : boolean := false
loop
    %do code
    %action permits an exit
    flag := true
    exit when flag
end loop


Please post the code so we can give some more help

-----------------------------------
Dannyd534
Mon Nov 13, 2006 7:43 pm


-----------------------------------
either send me the code and ill try to figure it out or...i think u do somthing like stop(or exit i forgot) when blah blah blah user clicks play or w/e u wanna do

-----------------------------------
Dannyd534
Mon Nov 13, 2006 7:54 pm


-----------------------------------
srry for double post but try here http://www.compsci.ca/v2/viewtopic.php?t=13288
