Skip to main content

Boolean

The boolean (Bool) is a type which can have two values, true and false. A Bool is considered an ADT when performing interactions with contracts.

Consider the below definition of creating a type similar to Bool.

type Example = | True | False

A Bool value can be returned from functions like builtin eq which leverages the two types of Bool to return a value. The value is_equal is either true or false.

is_equal = builtin eq a b

Therefore, we can use Bool ADT pattern matching to perform a basic if statement

match is_equal with    | True =>    | False =>end

Further reading#

Bool

BoolUtils