Loops/Foreach: Difference between revisions

Content deleted Content added
new Emacs Lisp
No edit summary
Line 1,513:
<lang smalltalk>aCollection do: [ :element | element displayNl ].</lang>
(Provided that the objects in the collection understand the <code>displayNl</code> method).
 
=={{header|Sparkling}}==
 
Sparkling currently has no "foreach" construct, but there's a "foreach" function in the standard library:
 
<lang sparkling>let hash = { "foo": 42, "bar": 1337, "baz": "qux" };
foreach(hash, function(key, val) {
print(key, " -> ", val);
});</lang>
 
=={{header|Standard ML}}==