Computer Science Canada

Problems with if statements

Author:  suckywinner123 [ Tue Jan 15, 2013 7:57 pm ]
Post subject:  Problems with if statements

Heyy, I am having some problems with making if statements work

Turing:

loop
    mousewhere (x, y, button)
    if button = 1 and x >= 1005 and x <= 1099 and y >= 0 and y <= 35 then

        if indicate := 3 then
            proc3
        elsif indicate := 2 then
            proc2
        elsif indicate := 1 then
            proc1
        end if


        exit
    end if
end loop




So basically, after one "if statement" i want the computer to immdeiatley make another "if statement" which only happens if the first "if statement" happens (if they clicked on that spot)
I want it so that if they click on that specific spot, depending on what the value of the "indicate" variable (which the user decides on if it's 3,2, or 1 earlier in the program) is, it takes them to different places, but it wont allow me, saying "if" must be boolean type, i am not very good at Turing, so any help would really be appreciated. Thanks Smile

Author:  tristanbryce7 [ Tue Jan 15, 2013 8:04 pm ]
Post subject:  Re: Problems with if statements

You're not supposed to use ":=" for comparison statements , only "=" or "<= or >=" Razz so just change you statement from
indicate := 3
to
indicate = 3

Author:  Insectoid [ Tue Jan 15, 2013 8:05 pm ]
Post subject:  RE:Problems with if statements

code:
if indicate := 3 then


You sure you want to be using ':=' there?

Author:  suckywinner123 [ Tue Jan 15, 2013 8:08 pm ]
Post subject:  Re: Problems with if statements

OHHHH, gosh, I can't believe I overlooked that haha :/ . Thanks so much !


: