How do I program an exit?
Author |
Message |
Edman
|
Posted: Thu Jan 06, 2005 1:14 am Post subject: How do I program an exit? |
|
|
So I have decided to rough it out. I am figuring this Turing stuff out for the most part, but I have run into a problem. Here's what I want to do:
I want to have the program ask "Would you like to play a game"
If the answer is "y" then the game begins
Now I know how to do the above, but how do I do this part:
If the answer is "n" then I want the program screen so say "goodbye" and the program ends.
Thank you. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Delos
|
Posted: Thu Jan 06, 2005 9:19 am Post subject: (No subject) |
|
|
There are a bunch of ways of doing this...really, a lot.
A few suggestions:
- look up if statements.
With these, you would either procedurize your proggie (recommended), or encompass the entire thing in one big if.
- you could use a loop that covers the whole proggie, and have an exit condition when the response is 'n' or something to that effect. This would also give you the flexibility of restarting the game.
- you could use 'quit', but try stay away from this as Turing really doesn't forgive when it comes to that particular command. |
|
|
|
|
|
|
|