# Blitz:Operators

Blitz Basic / AmiBlitz supports most operators from other languages and dialects. Internally Blitz represents true with -1 and false with 0, so expressions with a true or false result will return either -1 or 0. To make your code easier to read, the keywords True and False can be used wherever required instead of using the value -1 or 0. The compiler will convert these keywords to the relevant value for execution.

While -1 is used to represent true, any value other than 0 will be interpreted as true by If, While and Until statements.

### Comparisons

Used for If, While and Until statements, will return true or false as a result.

- a = b
- True if a equals b, false otherwise, equivalent of == in C
- a <> b (alternatively a >< b)
- True if a does not equal b, false if it does
- a < b
- True if a is numerically less than b, false otherwise
- a > b
- True if a is numerically greater than b, false otherwise
- a <= b
- True if a is numerically less than or equal to b, false otherwise
- a >= b
- True if a is numerically greater than or equal to b, false otherwise

### Logical Operators

These perform standard logic comparisons based on the true or false status of the input values. More than one logic operation can be used at a time and are carried out from left to right. Parenthesis can be used to control the order.

- NOT a
- True if a is false, false if a is true
- a AND b
- True if a and b are true, false otherwise
- a OR b
- True if either a or b are true, false if both a and b are false

### Binary Operators

These operators perform logic operations on the individual bits of the input values, rather than the overall value itself. for example, bitwise AND of 1001 and 0111 will return 0001, since the rightmost bit is the only bit set in both values.

- a & b
- Bitwise AND of a and b
- a | b
- Bitwise OR of a and b
- a LSL b
- a shifted b bits to the left
- a LSR b
- a shifted b bits to the right