Computer Science Canada proc only to except 4 answers otherwise loop |
Author: | n00b.skillz [ Sat Jan 13, 2007 6:10 pm ] |
Post subject: | proc only to except 4 answers otherwise loop |
okay well i am doing a trivia game and i am wondering is there a piece of code i can stick into my procedure to make it only accept a,b,c or d instead of accepting any letter of the alphabet saying it's wrong and going on. Sort of like if the user puts "a" then it will accept and say right or wrong but if the user puts something other than a,b,c or d .... something like "k" then the program will not accept this and stay at the question until it is responded to with one of the options a,b,c or d |
Author: | neufelni [ Sat Jan 13, 2007 6:42 pm ] | ||
Post subject: | RE:proc only to except 4 answers otherwise loop | ||
All you need is a simple if statement.
|
Author: | n00b.skillz [ Sat Jan 13, 2007 7:18 pm ] |
Post subject: | Re: proc only to except 4 answers otherwise loop |
yea i realize u can do it that way but can u do it without a put statement... just so the program doesn't move or just stays there until a valid choice is picked |
Author: | AK.E [ Sat Jan 13, 2007 7:31 pm ] | ||
Post subject: | Re: proc only to except 4 answers otherwise loop | ||
Why not try something like this
Obviously that can be expanded a lot but it gives you the general idea. |