Terminology
Term | Definition |
---|---|
loops | Perform a task repeatedly or a certain number of times, perform a task repeatedly until a condition is met or to process all of the items in a collection. |
while loop | When executing code that needs to continue running over and over until the condition in the while loop is true. For example: while(reading) {Console.WriteLine("I'm being read")} if reading becomes false there is nothing written to the console. |
for loop | Executes a block of statements repeatedly until the specified Condition returns false. |
Initialization | Do this at the start of the for loop. |
Condition | Keep going as long as this is true during the for loop. |
Afterthought | Do this after each loop through the for loop is done. |
foreach loop | Executes a block of code on each element in an array or a collection of items. |