Booleans and null

Booleans and null

> Tutorial

You have seen that it is possible to manipulate numbers, but the LeekScript also has special values: null and booleans.

null value

null is a value representing an empty, invalid or even an error value, but it is different from the number 0.

For example, the getWeapon() function returns the weapon your leek is holding, or null if you don't have a weapon in your hands.

You may have noticed that setWeapon() costs 1 TP per turn. It is possible to limit its use to turn 1 with this condition:

Booleans: true and false

Booleans are two values: true and false. These are two values that can be used to represent something that can have two states like:

Examples of functions that use booleans:

Example: we check if a chip needs a line of sight:

❓ Quiz

What can null be used for?

Representing a lack of information/value Represent the number 0 Represent an error Representing a poor quality program

What are booleans for?

Represent a value with two possible states Represent a very high value

Full AI