true, false

constant

Purpose

true and false are Boolean values that you can use to set or test the value of switch shelf items:

  process
     local switch fred
     local switch barney variable initial { true, false, true }
  
     set fred to true
  
     do when fred
        output "Switch fred is true!%n"
  
     else
        output "Switch fred is false!%n"
     done
  
     set barney[3] to false
  
     do unless barney[3]
        output "Switch barney[3] is false!%n"
     else
        output "Switch barney[3] is true!%n"
     done
  ; Output: "Switch fred is true!
  ;          Switch barney[3] is false!"
  
          

Note that switch shelf items evaluate to true or false value directly so that do when fred = true and do when fred do the same thing. Similarly, do when fred = false does the same thing as do unless fred.

Related Syntax
Related Concepts