Errortraping
Author |
Message |
Jai_eun
|
Posted: Mon Jan 12, 2009 8:58 pm Post subject: Errortraping |
|
|
I want to make an error trap for all my if statements below but i want them all to give the same message i tried declaring them as one variable but it didnt work
is there a way to error trap all of them without having to repeat the trap over again for eah if statement
sorry i couldnt figure out the syntax method for posting my code because it does not work for some reason
Turing: | %Program Processing & Display
procedure display
score := 0
total := 10
cls
title
colour (86)
locate (4, 31)
if answer1 = 2 then
score := score + 1
end if
if answer2 = 1 then
score := score + 1
end if
if answer3 = 3 then
score := score + 1
end if
if answer4 = 1 then
score := score + 1
end if
if answer5 = 4 then
score := score + 1
end if
if word1 = "Circumference" then
score := score + 1
end if
if word2 = "Quadrilateral" then
score := score + 1
end if
if word3 = "Arcs" then
score := score + 1
end if
if word4 = "Parallel" then
score := score + 1
end if
if word5 = "Equilateral" then
score := score + 1
end if
put "Your score is:", score div total * 100, "%"
GUI.Show (menuButton )
end display |
Mod Edit: Remember to use syntax tags! Thanks code: | [syntax="turing"]Code Here[/syntax] |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
The_Bean
|
Posted: Mon Jan 12, 2009 9:10 pm Post subject: Re: Errortraping |
|
|
You can hold all the the answers they give in 1 array, and hold all the correct answers in another array. Then you can quickly go through everything with a 'for' loop and check every answer to see if it is correct.
To use syntax tags:
code: |
[syntax="turing"]
%put code here
[/syntax]
|
|
|
|
|
|
|
|
|