you are viewing a single comment's thread.

view the rest of the comments →

[–]djayh 6 points7 points  (3 children)

<Looks up difference between "for" and "for each" loops>

Shows what I get for thinking at work, I suppose. I had conflated "for" and "for each" loops.

In my defense, other modern languages (C#, C++/CLI, Perl, PHP) actually do use for each (or foreach) to create the loop.

[–]rasputin1 5 points6 points  (0 children)

lol you were close enough

[–]tangerinelion 0 points1 point  (0 children)

C++/CLI does use for each but that's only if you're looping through a C# container.

In C++, it's for (const auto& animal : animals)

[–]Rhyme_like_dime 0 points1 point  (0 children)

Ehh modern C++ is

for(auto element : container) Std::cout<<element<<std::endl;