> Tutorial
You've seen that you can work with numbers, but there are also special values: null and booleans.
null valuenull is a value that represents an empty or invalid value, or even an error, but it's different from the number 0.
For example, me.weapon returns the weapon your leek is holding, or null if you don't have a weapon in your hands.
You may have noticed that me.setWeapon() costs 1 TP per turn. You can limit its use to turn 1 with this condition:
true and falseBooleans are two values: true and false. You can use them to represent anything that has two states, such as:
Examples of properties and methods that return a boolean:
enemy.alive returns true if the entity is alive, false otherwise.me.canUseWeapon(enemy) returns true if you can use your weapon on the enemy.Example: checking whether we can use our weapon on the enemy:
What can null be used for?
Representing a lack of information/value Representing the number 0 Representing an error Representing a poorly written program
What are booleans used for?
Representing a value with two possible states Representing a very large value
Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.