Computer Science Canada Help |
Author: | MPVoiD [ Thu Jan 22, 2015 1:19 pm ] |
Post subject: | Help |
My CompSci teacher wanted me to "write a function that returns a larger of two numbers". I'm extremely new at Turing and wondering what needs to be done in order for this to work. This is what I have right now, but it comes back with errors. var num1, num2 :int put "Enter two different numbers." get num1 get num2 if num1 > num2 then put num1 if num2 > num1 then put num2 |
Author: | Zren [ Thu Jan 22, 2015 1:27 pm ] |
Post subject: | RE:Help |
What does the error say? |
Author: | MPVoiD [ Thu Jan 22, 2015 7:45 pm ] |
Post subject: | Re: Help |
It says "Syntax error at 'end of file'. Expected 'end if'. |
Author: | bubb4h0t3p [ Thu Jan 22, 2015 7:46 pm ] | ||
Post subject: | Re: Help | ||
you forgot to close your if statements with "end if"
By the way everything after a "%" sign is a comment and ignored by the compiler |
Author: | MPVoiD [ Thu Jan 22, 2015 7:52 pm ] |
Post subject: | Re: Help |
oh, so I need to type "end if" after each if statment. Thank you very much - it work's now. |
Author: | MPVoiD [ Sat Jan 24, 2015 12:39 pm ] |
Post subject: | Re: Help |
How would I make this program work using a function? |
Author: | Insectoid [ Sat Jan 24, 2015 4:06 pm ] |
Post subject: | RE:Help |
Do you know how to use functions at all? |
Author: | Zren [ Sat Jan 24, 2015 4:59 pm ] |
Post subject: | RE:Help |
The Turing Walkthrough has a pretty good guide on functions if you don't. Functions and Procedures |
: |