The execution controller while is a lot like if. The difference is that while keeps repeating (looping) the code between the brackets until the boolean evaluates false. $x = 1 while $x & lt; 5 {forward 10 wait 1 $x = $x + 1} On the first line $x is set to 1. On the second line $x & lt; 5 is evaluated. Since the answer to this question is true the execution controller while starts executing the code between the brackets until the $x & lt; 5 evaluates false. In this case the code between the brackets will be executed 4 times, because every time the fifth line is executed $x increases by 1.
O controlador de execución mentres seméllase moito a se. A diferenza é que mentres repite o código entre as chaves até que a resposta á pergunta sexa falso. $x = 1 mentres $x & lt; 5 {avanza 10 agarda 1 $x = $x + 1} Na primeira liña x toma o valor de 1. Na segunda liña faise a pergunta x & lt; 5. Dado que a resposta é certo o controlador de execución mentres comeza a executar o código entre as chaves até que a resposta á pergunta sexa falso. Neste caso executarase 4 veces, porque cada vez que se executa a quinta liña x aumenta 1.