### Author Topic: if conditions: 'or' and 'and' = true?  (Read 679 times)

0 Members and 1 Guest are viewing this topic.

#### Aino

• Ent
• Thank You
• -Given: 1
• -Receive: 20
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### if conditions: 'or' and 'and' = true?
« on: February 06, 2011, 01:59:25 AM »
So if you have:
if a == 0 or a == 2 and b < c then

end

What happens then?

#### annikk.exe

• Achiever
• Ent
• Thank You
• -Given: 0
• -Receive: 0
• Posts: 1,794
##### Re: if conditions: 'or' and 'and' = true?
« Reply #1 on: February 06, 2011, 02:02:22 AM »
Unpredictable results.  Best not to mix your "ands" and "ors".

A better way is like this:

Code: [Select]
`if a == 0 or a == 2 then if b < c then --do stuff endend`

#### Aino

• Ent
• Thank You
• -Given: 1
• -Receive: 20
• Posts: 1,483
• They'll eat you next!
• Eufloria: Yes
##### Re: if conditions: 'or' and 'and' = true?
« Reply #2 on: February 06, 2011, 02:04:20 AM »
Unpredictable results.  Best not to mix your "ands" and "ors".

A better way is like this:

Code: [Select]
`if a == 0 or a == 2 if b < c then --do stuff endend`

Yea, that will correct it hopelyfully, ty

#### annikk.exe

• Achiever
• Ent
• Thank You
• -Given: 0
• -Receive: 0
• Posts: 1,794
##### Re: if conditions: 'or' and 'and' = true?
« Reply #3 on: February 06, 2011, 02:05:31 AM »
I corrected a typo in the code I posted. :>