@foreach


Description:

public void @foreach (Func<G> func)

Calls func for each item in the sequence passing user_data to the function.

func must not modify the sequence itself.

Example: Apply a function to each element:

public static int main (string[] args) {
Sequence<string> seq = new Sequence<string> ();
seq.append ("Lorem");
seq.append ("ipsum");
seq.append ("dolor");
seq.append ("sit");
seq.append ("amet");

// Output:
// ``Lorem``
// ``ipsum``
// ``dolor``
// ``sit``
// ``amet``
seq.foreach ((item) => {
print ("%s\n", item);
});

return 0;
}

valac --pkg glib-2.0 GLib.Sequence.foreach.vala

Parameters:

this

a Sequence

func

the function to call for each item in this

user_data

user data passed to func