Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Making a FOR loop repeat only once
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
(-.-)>YoGiBeHR<(-.-




PostPosted: Mon Nov 13, 2006 7:35 pm   Post subject: 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!
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Mon Nov 13, 2006 7:42 pm   Post subject: (No subject)

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:

Turing:

for Index : 1 .. 1
%code in here
end for


You could also have some sort of boolean flag and run a conditional loop:

Turing:

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




PostPosted: Mon Nov 13, 2006 7:43 pm   Post subject: (No subject)

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




PostPosted: Mon Nov 13, 2006 7:54 pm   Post subject: (No subject)

srry for double post but try here http://www.compsci.ca/v2/viewtopic.php?t=13288
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: