What are the differences between repeat structures while, repeat and for?

Friends, I'm learning programming logic and came this doubt when I should use these commands and their differences.

Author: mgibsonbr, 2016-03-30

1 answers

For - for a number of repetitions already defined, or even when you need to count the repetitions, and still when you want to read an array from the last to the first element.

While - when your code has the amount of undefined repetitions and depending on one or more conditions to stop the loop.

Repeat - when it is mandatory that the loop rotates at least once. The code block inside the loop will run the first time without the condition being checked.

 7
Author: Jhonny Mesquita, 2016-03-30 22:13:04