Operators

Top  Previous  Next

Tibbo Basic supports the following operators:

+ Operator

Addition operator (applies to strings as well).

 

 

i = 1 + 2 ' this would be 3

s = "foo" + "bar" ' this would be "foobar"

 

 

* Operator

Multiplication operator.

 

 

i = 5 * 2 ' 10.

 

- Operator

Subtraction Operator.

 

 

i = 20 - 5 ' 15

 

/ Operator

Division operator.

 

 

i = 30 / 10 ' 3

i = 10 / 3 ' also 3 -- only integers are supported, decimal part is removed.

 

MOD Operator

Used to divide two numbers and return the remainder.

 

 

i = 10 mod 3 ' this would be 1

 

= Operator

(1) Equality operator. (2) Assignment operator.

 

 

if i = 5 then .... ' as an equality operator

 

i = 5 ' as an assignment operator

 

 

AND Operator

(1) Logical AND. (2) Bitwise AND.

 

 

if i = 5 AND j = 10 then.... ' as a logical AND

 

 

x =

&b01011001 AND

&b10101011 ' this would be

&b00001001

 

NOT Operator

(1) Logical NOT. (2) Bitwise NOT.

 

 

if NOT b then.... ' as a logical NOT -- b is a boolean value

 

x = NOT &b01011001 ' this would be &b10100110

 

OR Operator

(1) Logical OR. (2) Bitwise OR.

 

 

if i = 5 OR j = 10 then.... ' as a logical OR

 

x =

&b10110101 OR

&b01011001 ' this would be

&b11111101

 

XOR Operator

(1) Logical XOR. (2) Bitwise XOR.

 

 

if i = 5 XOR j = 10 then.... ' as a logical XOR

 

&b10110101 XOR

&b01011001 ' this would be

&b11101100