last
Module Export
[value] |> value | nothingReturns the last element in the input iterator.
If the iterator is empty, nothing is returned.
Examples
Basic usage
import 'iterators'
from [1, 2, 3] lastResult:
3Combined with select
import 'iterators'
from [1, 2, 3] select x => x * 2 lastResult:
6Combined with until for early termination
import 'iterators'
let Error: { error: text }
let results = [ { value = 1 }, { value = 2 }, { error = 'something went wrong' }]
from results until r => r is Error lastResult:
{ error = 'something went wrong' }