Skip to main content
sort(list) returns a new list with all elements sorted in ascending lexicographic order.

Signature

Example

Sort a list of service names alphabetically before printing a deployment summary, so the output is consistent across runs regardless of declaration order:
Output: Services in this release: api, gateway, scheduler, worker.

Notes

  • sort only works on list(string). For numbers, convert to strings first or sort within shell commands.
  • The sort is lexicographic, not numeric. "10" sorts before "9" when treated as strings.
  • sort returns a new list and does not modify the original.