Computer Science Canada if/elsif help? |
Author: | qmanjr5 [ Tue Dec 01, 2009 8:12 pm ] | ||
Post subject: | if/elsif help? | ||
What is it you are trying to achieve? Fix my if/elsif What is the problem you are having? Can't figure it out Describe what you have tried to solve this problem Asked friends Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) I KNOW MY CODE ISN'T THE BEST, IT'S THE FIRST THING I'VE DONE!!!!! please don't start on me about that ![]()
Please specify what version of Turing you are using 4.1.1 |
Author: | Zren [ Tue Dec 01, 2009 8:18 pm ] | ||
Post subject: | RE:if/elsif help? | ||
Where is your elsif? And it structured:
|
Author: | qmanjr5 [ Tue Dec 01, 2009 8:20 pm ] |
Post subject: | RE:if/elsif help? |
I'm a bit confused :'( The answer to question 1 or answer1 is obviously 2, so how I would I code it so that if you enter 2, it'll bring up the procedure correct, and if you enter ANYTHING else, then it'll bring you to the procedure incorrect? If you guys would be so kind, use my variables and everything, I'm usually very confused if I don't see my variables and everything. |
Author: | Zren [ Tue Dec 01, 2009 8:32 pm ] | ||
Post subject: | Re: RE:if/elsif help? | ||
Zren @ Tue Dec 01, 2009 8:18 pm wrote: Sorry, I thought your question was talking about Elsif. Your looking for the else part of conditions. Basically it runs the code if the condition in the if statement isn't true (as well as for any elsif conditions too).
|
Author: | qmanjr5 [ Tue Dec 01, 2009 8:56 pm ] |
Post subject: | RE:if/elsif help? |
So, if I put [syntax="turing"] if answer1 = 2 then correct else incorrect end if [syntax] |
Author: | Kharybdis [ Tue Dec 01, 2009 9:29 pm ] |
Post subject: | RE:if/elsif help? |
That's correct, gmanjr5. The else statement exists so you can take in all the possible cases for your if statement. Add elsif statements only if there's more than one condition that you're looking for. |
Author: | qmanjr5 [ Wed Dec 02, 2009 12:13 pm ] |
Post subject: | RE:if/elsif help? |
Thank you all, espeically khary ![]() |