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.
4
questions
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 ...
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 ...
-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:
...
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 ...