0.18 Using booleans

Booleans are expressions or values that are either true or false. They are used to conditionally execute parts of your program. In 4tH a value is false when it is zero and true when it is non-zero. Most booleans come into existence when you do comparisons. This one will determine whether the value in variable 'VAR' is greater than 5. Try to predict whether it will evaluate to true or false:

     variable var
     4 var !
     var @ 5 > .

No, it wasn't! But hey, you can print booleans as numbers. Well, they are numbers. But with a special meaning as we will see in the next lesson.