Loops

A set of blocks that allow you to set a set of actions with a predetermined number of repetitions, as well as for bypassing lists

../../../_images/image_14.png

Iterative Loop

The simplest example of a loop is to repeat some action N times

../../../_images/image_24.png

The loop with the counter will be executed while the variable i is less than 5. In this case, after each step, the variable i will increase by 1

../../../_images/image_3_1.png

Such a loop is a more convenient notation for Conditional Loop

Loops with a counter are convenient for iterating over the elements of a list. In this example, each i-th element of the list is assigned the value i

That is, the 1st element = 1, the 2nd = 2, etc.

../../../_images/image_3_2.png

Conditional Loop

The loop will run as long as the condition is true

../../../_images/image_43.png

Iterating over the elements of a list

In this example, each element of the list is assigned 1

../../../_images/image_51.png

Loop exit

A block can only be used inside a loop. Usually, a loop exits when a certain condition is met

In the example, the loop exits at the moment when the loop counter i exceeds the length of the list list

../../../_images/image_61.png