[Tutor] foreach loops

Alan Gauld alan.gauld at freenet.co.uk
Tue Sep 12 20:09:41 CEST 2006


> I was thinking more along the lines of this:
> 
> A C++ for loop:

This is exactly NOT a foreach loop, its a vanilla for loop.

> 
> #include <iostream>
> 
> using std::cout;
> 
> int main() {
> 
> for (int i = 0; i < 10; i++) {
> cout << i << "\n";
> }

for i in range(10): print i

Alan G.


More information about the Tutor mailing list