Sign in to follow this  
Followers 0
Cusem

AND OR operator question

5 posts in this topic

I don't know exactly how autoit cumulates and handles AND and OR operators.

If $c = $d AND $a + $b = 14 AND $a = 1 OR $b = 1 Then

I'm not sure how the OR will be treated.

For this to be TRUE, I want:

$c = $d must be TRUE

$a + $b = 14 must be TRUE

$a = 1 OR $b=1 one of these two must be TRUE (So $a=1 is sufficient, $b doesn't have to be 1, but if $a <> 1, $b has to be 1)

Will this work?

Or do I have to create another IF statement within the first IF statement? Or is there another possibility like working with ()'s like

If $c = $d AND $a + $b = 14 AND ($a = 1 OR $b = 1) Then

Thanks!

Share this post


Link to post
Share on other sites



Thanks!

Didn't know if parentheses would work in an If statement but apparently they do.

Thanks again!

Share this post


Link to post
Share on other sites

In order of operations, boolean operators usually come last. At that point they are evaluated from left to right. [usually]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0