Booleans in Trillium

A boolean type is declared with the var keyword, or with the implicit : bool and can only take the values true or false.

Below will show you how booleans are handled in Trillium and how you can define booleans.

Declaring Booleans

Below will show you how to declare booleans

Above you can see that you first create a bool variable by defining 'var someTruth' and setting it equal to true. You can also define a bool implicitly by using the ' : bool ' nomenclature.

Using Booleans

Bools have a wide variety of use as they can be the result against other variable types like strings or ints.

You can see above some common uses for bools in Trillium. Of course this is a basic example and other use cases exist.

Casting to a Boolean

Depending on the return type a method uses it won't always return a boolean, but rather a string of a boolean like 'true', so we need to cast this to a boolean.

If you pass the string 'true' to our method above it will return a boolean value of True

An error has occurred. This application may no longer respond until reloaded. Reload 🗙