Computer Science Canada

Returning to input

Author:  typon [ Sun Jan 16, 2005 12:27 pm ]
Post subject:  Returning to input

hi, i'm having a problem with errorproofing. K E.g. if there are 3 numbers that i want from the user. they enter the first number correct, but they make a mistake on the second number, i error trap it so it an errorwindow pops up.
but when i say

loop
exit when hasch
end loop
userinput(procedure)

it will start from asking the first number again. is there a way to continue the procedure from a specific point?

Author:  AsianSensation [ Sun Jan 16, 2005 1:53 pm ]
Post subject: 

you probably have to set a couple of boolean variables inside your procedure.

Like in your get procedure, you have something like this:

code:

get num1
get num2
get num3


now incorporate some flags:

code:
flag1 := false
flag2 := false

if flag1 = true and flag2 = true then
    get num3
elsif flag1 = true
    get num2
    flag2 := true
else
    get num1
end if


so that you check to see whether you have gotten the number before.

Author:  typon [ Sun Jan 16, 2005 5:56 pm ]
Post subject: 

What?

Author:  Cervantes [ Sun Jan 16, 2005 6:49 pm ]
Post subject: 

Do you know what boolean variables are?
Think about it. Work it out. Yourself.
hint: Asian left one line out of that if statement.


: