A Boolean is a type that is represented by either a value of one or a value of zero. To make it easier to use the values have been given names: true & false.
Boolean values are typically used for conditional logic or validation, for example in if expressions, and thus expressions are said to be evaluated to true or false.
Using the unary operator ! the Boolean value can be changed:
- From
truetofalse - From
falsetotrue
The following example creates two Boolean variables, performs a comparison using the unary operator ! and implicitly returns the result.
{{#include ../../../code/language/built-ins/booleans/src/lib.sw:syntax}}