# How Do You Use Or, Not, And

## Recommended Posts

How do you use the OR statement

example:

IF \$NoReceiptPrnt <5 OR >10 Then

##### Share on other sites

If \$NoReceiptPrnt < 5 OR \$NoReceiptPrnt > 10 Then...

If 1 = 1 AND 2 = 2 Then... (Always true)

If Not(1=2) Then (Always true)

##### Share on other sites

Thanks guys

I'm now stuck again

Example1:

IF \$name = NOT 'paul' THEN

msgbox -------

IF \$name = NOT 'paul' OR \$name = NOT 'ste' THEN

msgbox -------

Doesn't seem to work properly is the "NOT" in the right place

##### Share on other sites

If Not(\$name = "paul")

or you can use

If \$name <> "paul"

##### Share on other sites

AND, OR, and NOT are used with entire conditions, not values (well not like that anyway ). So, use these like this:

`If \$i > 15 AND \$j < 15 Then`

The conditions \$i>15 and \$j<15 must both be true for the entire thing to be considered true.

`If \$i > 15 OR \$j > 15 Then`

The conditions \$i>15 and \$j>15 must either be true for the entire thing to be considered true. If both are true, it is still considered true.

`If NOT \$i>15 THEN`

Reverse the value of the condition. You might want to use

`If \$i <= 15 THEN`

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

##### Share on other sites

CODE

If NOT \$i>15 THEN

Reverse the value of the condition. You might want to use

David, I think because of the operator precedence stuff, that is resolved to (NOT \$i)>15 when what you really meant was Not(\$i > 15).

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...