Computer Science Canada I need help (little thing) |
Author: | bboy_ayz [ Sun Nov 27, 2005 1:25 pm ] |
Post subject: | I need help (little thing) |
Listen, i made a game basicly like who wants to be a millionaire. So i put a question a)blala b)blalal .. u understand then i put if one = "a" then put "Nice" dely (blblba) cls else put "Sorry, you choose the wrong answer you have to leave" now here i want to make the program exit.. i tried to put exit but it tells me its ment for loop or for i.. is there any way to make my program leave if the answer is worng? |
Author: | Dan [ Sun Nov 27, 2005 1:42 pm ] |
Post subject: | |
1st off on this site the rules say you may not make topics with subject names that are not descripive of the problem or basily say "i need help". Somthing to keep in mind for next time you post. now as for your problem, noramly in good progaming pratices you whould not need to do this. Uhsely one whould put all the code in a while loop such as: while flag = true do code here end while loop and when u whont to exit the progame or loop you set flag to flase. But if you most i think the comand in turing to do what you whont in return but i am not shure of this. |
Author: | bboy_ayz [ Sun Nov 27, 2005 2:43 pm ] |
Post subject: | |
man, i dont really get what you wrote this is my script ( i have the question and option on top and i have vars, all good) get one if one = "c" then delay (500) put "Nice!" score := score + 100 delay (1000) cls else put "Wrong!!" delay (500) put "Sorry to tell you but you have to leave" exit end if cls can you tell me what to write so that if the answer is not "c" it will leave the program ? thx |
Author: | Cervantes [ Sun Nov 27, 2005 2:57 pm ] | ||
Post subject: | |||
Alternatively, you could wrap everything in a loop, and exit it. It's sort of like faking a goto line. |
Author: | Mystify [ Tue Nov 29, 2005 9:45 am ] |
Post subject: | |
What about... loop if "answer" = "a" then put "Correct!!" exit when "answer" = "b" or "c" or "d" end loop |
Author: | ZeroPaladn [ Tue Nov 29, 2005 9:58 am ] |
Post subject: | |
Mystify wrote: What about...
loop if "answer" = "a" then put "Correct!!" exit when "answer" = "b" or "c" or "d" end loop its more like... [code="Turing"]loop if awnser = "a" then put "Correct!!" exit when awnser = "b" or awnser = "c" or awnser = "d" end loop [/code] |
Author: | Mystify [ Tue Nov 29, 2005 10:16 am ] | ||
Post subject: | |||
yeah i thought it was like that i have my own who wants to be a millionaire game heres what i left off at just to give you an idea....
|