each_idx_val multimethod

Methods

each_idx_val(e:Eachable1, cb:Fun) Source: stdlib.ngs:2611
Iterates over elements of e, passing each in turn to cb along with index and args: cb(INDEX, ITEM)

Returns

e

Example

"abc".each_idx_val(F(idx, val) echo("Element #$idx equals to $val"))
each_idx_val(arr:Arr, cb:Fun) Source: stdlib.ngs:2622
Iterates over the elements of arr, passing each in turn to cb along with index and args: cb(INDEX, ITEM)

Returns

arr

Example

[10,20,30].each_idx_val(F(idx, val) echo("Element #$idx equals to $val"))