Problems with if statements
Author |
Message |
suckywinner123
|
Posted: 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 Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
tristanbryce7
|
Posted: 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 >=" so just change you statement from
indicate := 3
to
indicate = 3 |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
suckywinner123
|
Posted: 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 ! |
|
|
|
|
![](images/spacer.gif) |
|
|