Talk:While loop

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing  
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.

The example given on this page is badly chosen, when the number of iterations is known a For loop is the better choice than a while loop. It is the main difference between a for and a while loop, for a while loop you do not need to know the number of iterations up-front, that is, a while loop is more powerful and the example should illustrate that. Alas, I am not knowledgeable in all ten languages presented on the page and can thus not change the example.

Perl example[edit]

Regarding "Very similar to C and C++, but the while loop could also have been written on one line:":

Why is this example used? Apparently to show off Perl's compactness compared to C and C++, except that C and C++ can do it in one line also, just as compact. That part should be deleted. —Preceding unsigned comment added by Codehead1 (talkcontribs) 19:32, 1 June 2009 (UTC)