
-----------------------------------
TheMaisha
Thu Dec 15, 2011 7:45 am

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?

-----------------------------------
Zren
Thu Dec 15, 2011 10:40 am

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
Thu Dec 15, 2011 5:08 pm

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



get answer


loop
    exit when answer = "n"
    %your code
end loop

