Yielding
yield
// Example 1: A program which yields some values.
yield 1;
yield 2;
yield 3;
// Result will be the sequence value [1, 2, 3]// Example 2: A program which yields from inside a loop
for x in [1, 2, 3] {
yield x * 2;
}
// Result will be [2, 4, 6];yield from
Advanced: Lazy evaluation
Last updated
Was this helpful?