Skip to content

If statements

Alvin Cheng edited this page Jan 9, 2023 · 1 revision

Description

Like any other programming language, if statements are a key building block to any program. With the if statements you can check a value against another value with an operator. In the Chill&chat CLI, you can create an if statement with argument 1 against argument 3 with argument 2 as an operator and argument 4 as a function body.

Operator guide

There are many operators that the if command support. Here is a list of them below:

isEqualTo - Checks if argument 1 is equal to argument 2 similar to ==.

notEqualtop - Checks if argument 1 is not equal to argument 2 similar to !=.

greaterThan - Checks if argument 1 is greater than argument 2 similar to >.

smallerThan - Checks if argument 1 is smaller than argument 2 similar to <.

greaterOrEqualTo - Checks if argument 1 is greater or equal to argument 2 similar to >=.

smallerOrEqualTo - Checks if argument 1 is smaller or equal to argument 2 similar to <=.

isDivisibleBy - Checks if argument 1 is divisible by argument 2 similar to % == 0.

isNotDivisible - Checks if argument 1 is not divisible by argument 2 similar to % != 0.

Example

if "<VALUE>" isEqualTo "<VALUE>" (
     # Code here...
)
Clone this wiki locally