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:Services in this release: api, gateway, scheduler, worker.
Notes
sortonly works onlist(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. sortreturns a new list and does not modify the original.