if condition then statement 1 else
statement 2
IDL> i=2 IDL> if i eq 2 then print,'I is two' else print, 'i is not two' I is twoor
IDL> if i eq 2 and j eq 3 then print,'I is two and J is three' else print, 'i and j are not two and three respectively'
The logical operators look like the FORTRAN ones (but without the dots), not like the C ones.
| Purpose | IDL | C | FORTRAN |
| Relational Operators | |||
| Equal to | eq | == | .EQ. |
| Not equal to | ne | != | .NE. |
| Less than or equal to | le | .LE. | |
| Less than | lt | .LT. | |
| Greater than or equal to | ge | .GE. | |
| Greater than | gt | .GT. | |
| Boolean Operators | |||
| And | and | && | .AND. |
| Not | not | ! | .NOT. |
| Or | or | || | .OR. |
| Exclusive OR | xor |