Boolean Type

The Boolean type represents a logical value that can be either True or False.

Literals

The two standard boolean constants are True and False. They are case-insensitive in the source code but conventionally written in PascalCase.

// Type inference
var isReady := True;
var hasFinished := False;

// Explicit typing
var isValid : Boolean := True;
var isComplete : Boolean;
isComplete := False;

Operations

Booleans are used with logical operators: not, and, or, and xor.

var a := True;
var b := False;

var result := (a or b) and (not b); // True

Comparisons

Comparison operators (=, <>, <, >, <=, >=) result in a Boolean value.

var x := 10;
var y := 20;
var isGreater := x > y; // False

String Conversion

Booleans can be converted to strings using BoolToStr or the .ToString helper.

var b := True;
PrintLn(b.ToString); // "True"
Result
True

Logic & Control

Booleans are the foundation of decision making. See Conditionals for usage in if and case statements, or Basic Operators for logical operations like and, or, and not.

On this page