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

1

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

    
asked by anonymous 30.03.2016 / 23:01

1 answer

6

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

WHILE - When your code has the number of undefined reps and depending on one or more conditions to stop the loop.

REPEAT - When the loop is required to run at least once. The code block inside the loop will run the first time without the condition being checked.

    
30.03.2016 / 23:10