-
Notifications
You must be signed in to change notification settings - Fork 89
Lists and Indexed Iteration
NN--- edited this page Apr 18, 2012
·
5 revisions
- Category: Lists, Tuples and Options
- Description: This sample shows simple uses of 'IterI' and foreach operator
- Code 1:
using System.Console;
def data = ["Cats", "Dogs", "Mice", "Elephants"];
foreach (x in data with i)
WriteLine($"item $i: $x");
- Code 2:
using System.Console;
def data = ["Cats", "Dogs", "Mice", "Elephants"];
data.IterI((i, x) => WriteLine($"item $i: $x"))
- Execution Result:
item 0: Cats
item 1: Dogs
item 2: Mice
item 3: Elephants
[Copyright ©](Terms of use, legal notice)