last
Full name: taxi.stdlib.last
Signature
declare extension function <T> last(collection: T[]):TDescription
Returns the last item within the collection. Throws an error if the collection is empty.
This function retrieves the final element in an ordered collection.
// Get the oldest transaction from a date-sorted list
find { account: Account } as {
oldestTransaction: account.transactions.last()
}Examples
This example demonstrates how to use last() to retrieve the oldest transaction for an account.
Try it out
Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed