
-----------------------------------
Jonny Tight Lips
Thu Feb 17, 2005 6:29 pm

ands and ors in ifs
-----------------------------------
I just want to know how turing does the ands and ors in ifs.
For examlpe if I had:

if var1 = 2 and var2 = 3 or var3 = 4 then 

does it do
var1 has to be true and var2 or var3 can be true
or
var1 and var2 have to be true or var 3 can be true

I hope you understadn what I'm talking about I know its a little confusing but I didn't know how else to explain it.

-----------------------------------
Token
Thu Feb 17, 2005 7:27 pm


-----------------------------------
okay, i'll try and use your example, 

if var1 = 2 and var2 = 3 or var3 = 4 then 


for that statement to work var1 AND var2 have to be  true

or if var3 was true then it would work

the way i do it is look at each section as its own little if statement, for example

if var1 = 2 and var2 = 3 or var3 = 4 then 

i separate the two different sections by the or statement. i'll give another example

if var1=1 and var2 =2 or var1 = 3 and var2 = 6 or var1 =5 then

i know its kind of confusing but what i do is say it in my head and think of it in litteral terms

-----------------------------------
Drakain Zeil
Thu Feb 17, 2005 7:31 pm


-----------------------------------
if x=y then
put "blah"
end if

When turring sees x=y it evaluates for a boolean (true/false).

You can't go:

if x=y or z or l then
put "blah"
end if

Since OR evaluates between two booleans, it doesn't repeat the "x=" bit. That's how you wish it worked.

All of the math evaluation signs (>.