Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 790 Bytes

File metadata and controls

18 lines (11 loc) · 790 Bytes

Boolean Type

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 true to false
  • From false to true

Example

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}}