What is a 'For Loop' and why do I need it?

Asked by kemiadewale · 6 months ago

1 Answer

20
amorebise · 6 months ago Top Answer

A 'For Loop' is used to repeat an action for every item in a list. Imagine you have a bag of 10 oranges. A loop says: "For every orange in this bag, wash it."

Instead of writing 'wash' ten times, you write it once inside the loop. It saves you time and prevents mistakes. Efficiency is the mark of a good programmer.

Log in to add a comment.