Skip to content

last

last(array) → element or null · Array

Returns the last element of an array, or null if the array is empty.

  • array (required): the source array
utlx
last(["Apple", "Banana", "Cherry"])      // "Cherry"
last([42])                               // 42
last([])                                 // null

// Use case: get the most recent event
{
  latest: last(sortBy($input.events, (e) -> e.timestamp))
}

Released under AGPL-3.0.