Friends, I'm learning logic programming and came up with this doubt when I should use these commands and their differences.
Friends, I'm learning logic programming and came up with this doubt when I should use these commands and their differences.
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.