Talk:Foreach loop

message: I'm proposing that this article be merged into the For loop article.
Please discuss on that article's talk page. — Dmeranda 17:06, 17 May 2006 (UTC)
replies: text: Was turned down -  see Talk:For loop --Krischik T 14:18, 1 February 2008 (UTC)
thread_title:  Proposal to merge into [[For loop]] 

message: It is common for a foreach style iteration not to guarantee any particular order of iteration, as comparted to indexed iteration. I think this should be mentioned?
putgeminmouth 02:47, 5 May 2007 (UTC)
replies: text: I think it depends on the language. In C#, the foreach statement is just a syntactic sugar for which an ordinary loop with an enumerator object manipulated is emitted, so the order of iteration is given by implementation of the underlying enumerator (of couse, if you take an array, stack or a list, their enumerators will enumerate objects in the order you would expect :-)). --Ondrejsv 21:21, 7 July 2007 (UTC)
thread_title:  Order of iteration 

message: Smalltalk support for "foreach" seams to be a border line.
While for C++ I think it is clearly an "unsupported" as language does not support foreach and it is emulated by libraries.
Smalltalk too implements foreach as library function. However there is difference: In Smalltalk all control structures are implemented as library features - so I am inclined to see Smalltalks do: [ :each as first class language feature.
--Krischik T 13:51, 1 February 2008 (UTC)
thread_title:  Does Smalltalk support foreach nativly? 

message: Flash (ActionScript) has a function for(... in ...) . --Hkhk59333 (talk) 03:43, 19 March 2009 (UTC)
thread_title:  [[Flash]] ([[ActionScript]]) 

message: What does qualify the word idiosyncratic in the PHP part?
:PHP has an idiosyncratic syntax
Not that I care about PHP, but it doesn't sound very neutral to me, which I think it should.
--Rfc (talk) 23:07, 29 March 2009 (UTC)
thread_title:  PHP 

message: The statement, Several languages, including Tcl and Python, have only a foreach loop, requiring explicit counting  to achieve "standard" for behavior. is a bit troublesome to me.  In Python, the common idiom
 for i in range(n):
isn't what I would call explicit counting.  This can be remedied by adding something like, or language-specific idioms, but by the time you're really said it correctly, it's gotten kind of complicated.  I'm wondering if maybe it's better to drop the entire statement?  -- RoySmith (talk) 19:51, 6 June 2009 (UTC)
replies: text: Hello, 2009. I removed the statement altogether, because it's false. Python doesn't have "only" a foreach loop, as it has the common while loop which is only syntactically different from for-looping. 212.68.15.66 (talk) 07:29, 23 February 2011 (UTC)
thread_title:  Use of Python range() in loops 

message: I think it would be better to have an example using Boost foreach than QT. Having both would be fine, but might make the section too long.
These are the reasons a Boost example would be more useful to the average interested party:
* A single Boost library is a lot smaller to integrate into your project than all of QT.
* The example shouldn't use strange QT syntax to construct the list or qDebug(), but something that all C++ programmers would know.
* QT makes a copy of the container, which is fine for QT containers but is expensive in general.
* QT makes a copy of the container, so modifications to the iterated object are silently lost, whereas Boost foreach can mutate the container.  — Preceding unsigned comment added by 74.85.42.110 (talk) 01:51, 7 September 2011 (UTC)
thread_title:  C++ examples 

message: An editor has asked for a discussion to address the redirect Iterative for loop. Please participate in the redirect discussion if you wish to do so.  — Arthur Rubin  (talk) 10:56, 19 May 2019 (UTC)
thread_title:  Iterative for loop listed at [[Wikipedia:Redirects for discussion|Redirects for discussion]]