import { forEach } from "https://deno.land/x/iter@v3.2.3/lib/effectors.ts";
Performs the specified action for each item in an iterable, consuming the iterable in the process.
Examples
Example 1
Example 1
import * as iter from "https://deno.land/x/iter/mod.ts";
const naturals = iter.create.increments(1);
const first6 = iter.take(naturals, 6);
iter.forEach(first6, x => console.log(x));
// -> 1
// -> 2
// -> 3
// -> 4
// -> 5
// -> 6
Parameters
it: Iterable<T>
- The iterable being looped over.
f: ForEachCallback<T>
- A function that accepts up to three arguments.
forEach
callsf
one time for each item in the iterable.