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

Username:   Password: 
 RegisterRegister   
 How do you exit or continue in Turing?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheMaisha




PostPosted: Thu Dec 15, 2011 7:45 am   Post subject: How do you exit or continue in Turing?

For example I want to ask the user

put "Do you want to play?"
get answer

I want the program to exit if the user says no and continue on if the user says yes.

How do I do this?
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Thu Dec 15, 2011 10:40 am   Post subject: RE:How do you exit or continue in Turing?

To 'exit' is to reach the end of your code. That involves breaking out of any loops you may be in. Alternatively, if you're not dealing within a main loop, you can instead check if the input is the yes condition and call the rest of the code in a procedure. The no condition wouldn't call the code, thus skipping it and continuing on to the end of code.
Amarylis




PostPosted: Thu Dec 15, 2011 5:08 pm   Post subject: Re: How do you exit or continue in Turing?

So I'm assuming that you want to use a loop after that, so what I would do is this


Turing:

get answer


loop
    exit when answer = "n"
    %your code
end loop
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  [ 3 Posts ]
Jump to:   


Style:  
Search: