Skip to main content

Questions tagged [for-loops]

For questions about the usage, implementation or design of for loops. For loops are loops designed to iterate a fixed sized collection or loop a fixed number of times.

Filter by
Sorted by
Tagged with
8 votes
3 answers
497 views

Loop syntax for inclusive and exclusive end boundaries

While the C-style for loop syntax is badly designed from a don't repeat yourself perspective, it does offer an advantage over ...
supercat's user avatar
  • 1,946
9 votes
5 answers
461 views

What would a for loop return in an expression oriented language?

An expression-oriented language sounds appealing, as I could have code logic inline in expressions and initializers. An if statement could just return the last ...
CPlus's user avatar
  • 9,063
-5 votes
1 answer
463 views

What are the pros and cons of implementing indexed for loops? [duplicate]

When iterating over an array you can use an indexed for loop, like so: ...
Redz's user avatar
  • 1,086
18 votes
8 answers
1k views

What are advantages and disadvantages of C-style for loops?

There are two kinds of for loops: the kind that Python has, also called a "foreach": for i in [1, 2, 3]: print(i) and the kind that C has, which is ...
Bbrk24's user avatar
  • 9,277