I n programming how does on know where to put loops and which one?

949 views

I n programming how does on know where to put loops and which one?

In: Other

6 Answers

Anonymous 0 Comments

A for loop is used when you want to do something a specific number of times. They’re often used if you need to perform some operation on every member of an array. A for each loop is pretty similar to a for loop, just with slightly different a syntax.

A while loop is used when you need the loop to keep executing the loop and unknown number of times until some condition is met. A do while loop is similar to a while loop but is guaranteed to execute at least once.

You are viewing 1 out of 6 answers, click here to view all answers.