Looping
Looping: While Loop, Do-While Loop, For Loop, For-Each Loop.
Updated
- While Loop (Novice): A while loop repeats a block of code for as long as its condition is true, which suits jobs where you don't know the number of repeats in advance.
- Do-While Loop (Apprentice): The do-while loop is similar to the while loop, but it guarantees that the block of code will be executed at least once since the condition is evaluated after the execution of the loop body.
- For Loop (Novice): The for-i loop, often referred to simply as a for loop, is commonly used for iterating over a range of values, such as the elements in an array.
- For-Each Loop (Apprentice): The for-each loop is a simplified version of the for loop that enables you to iterate over the elements of a collection or array without needing to manage an index variable.