while

Help Contents First Steps In Logo Built-in instructions Controlling program flow while
repeat Defining actions

while


There is another type cycles - while cycles.

As you can guess, they use the instruction while.

while :a<10
[
	print :a
	make "a :a+1
]

A while-cycle is similar to a repeat-cycle because it asks Logo to execute a list of instructions several times.

The difference is that if you use while, then the repetition is canceled only when a condition is not fulfilled.

The example above instructs Logo to print out the current value of a until it is less than 10.

Examples:
References:

repeat Defining actions