length(collection) returns the number of elements in a list, tuple, set, or map.
Signature
Example
Guard a deployment task so it only runs when at least one target service is specified:--var 'services=[]' is passed or the default is used, the task is skipped. When services are provided, the deployment proceeds.
Notes
lengthworks on lists, sets, maps, and tuples. It does not work on strings, numbers, or booleans.- For maps,
lengthreturns the number of keys.