peek<functionName>(__iterable);
function functionName(__value) {}
Description
Call a function for each element in an iterable. This returns an unchanged iterable.
The function argument should be a function accepting a single argument.
When the argument to peek is an OBJECT
, the function will be passed an OBJECT
with a single key-value pair.
Example
use System; var inputs = [1,2,3,4,5,6,7,8,9,10]; var peekedInput = peek<print>(inputs); consume(peekedInput); // Peek is executed function print(num) { System.print(num); }