➰Control Statement
Currently, we only support For Loop
Control Statements: For Loop
Syntax:
Monkeys <variable_name> <start> <end> [<step>]Explanation: The Monkeys control statement in Animal Script is used to create a for loop, allowing you to iterate over a sequence of values. The syntax consists of four components:
Monkeys: This keyword initiates the for loop statement.<variable_name>: This is the name of the variable that will be used as the loop counter. It can be any valid variable name.<start>: This is the starting value for the loop counter. It specifies where the loop will begin iterating.<end>: This is the ending value for the loop counter. It specifies where the loop will stop iterating.[<step>]: (Optional) This specifies the increment (or decrement if negative) for each iteration of the loop. If not specified, the default step is 1.
Example:
Monkeys i 0 5In this example, the for loop will iterate over the values from 0 to 5 (inclusive) with a step size of 1. The loop counter variable is i.
Last updated