Tyl Programming Language
▶ BOOLEANS
Boolean variable has only two optional values: TRUE, FALSE.
To declare a boolean variable, write:
is_solid \t
is_liquid \f
Tyl symbolizer will replace '\t' with '' (the TRUE symbol), and '\f' with '' (the FALSE symbol):
is_solid
is_liquid
If you want to change the value of a boolean variable to its opposite value, use the not system function:
is_solid
is_liquid not is_solid
In line: 'is_liquid not is_solid', is_liquid variable gets the result of the negation of is_solid variable.

There are some boolean operators that can be applied to boolean variables. AND operation will yield the result: TRUE, if both variables are TRUE.

AND operation:
is_solid
is_blue
is_solid_and_blue is_solid * is_blue
The multiply operator: '*', is used as the AND operator for boolean variables.

OR operation will yield the result: TRUE, if at least one variable is TRUE.

OR operation:
is_solid
is_blue
is_solid_or_blue is_solid + is_blue
The plus operator: '+', is used as the OR operator for boolean variables.

In Tyl we use also the divide operator: '/', to make a special boolean operation: AND_NOT.

The operation: A AND_NOT B:
is_solid
is_blue
is_solid_but_not_blue is_solid / is_blue

Here's Move Colors program:
is_red
is_green
is_blue

move_left »
 temp is_red
 is_red is_green
 is_green is_blue
 is_blue temp

move_right »
 temp is_blue
 is_blue is_green
 is_green is_red
 is_red temp

get_color »
 is_red ?
  'RED'
  
  is_green ?
   'GREEN'
   
   is_blue ? 'BLUE'
  


main »
print get_color
move_right
print get_color
move_right
print get_color
move_left
print get_color
move_left
print get_color
RED
GREEN
BLUE
GREEN
RED