Loops/Foreach: Difference between revisions
→{{header|Objective-C}}: conventional syntax
(Bait solution) |
(→{{header|Objective-C}}: conventional syntax) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 418:
=={{header|Bait}}==
`for-in` loops work with both builtin container types (arrays and maps).
They allow to iterate the
<syntaxhighlight lang="bait">
Line 1,842:
=={{header|langur}}==
A for in loop iterates over values and a for of loop iterates over
<syntaxhighlight lang="langur">for .i in [1, 2, 3] {
writeln .i
Line 2,187:
{{works with|Cocoa}}
<syntaxhighlight lang="objc">NSArray *collect;
// ...
for (Type i in collect) {
NSLog(@"%@", i);
}</syntaxhighlight>
Line 2,196:
{{works with|Objective-C|<2.0}}
<syntaxhighlight lang="objc">NSArray *collect;
// ...
NSEnumerator *enm = [collect objectEnumerator];
id i;
while
// do something with object i
}</syntaxhighlight>
|