For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/manifest/functions/collections/length.md.

length

Returns the total number of elements in a list, keys in a map, or characters in a string.

Signature

length(collection: any) -> int

Parameters

ParameterTypeRequiredDescription
collectionanyyesCollection or string to measure

Return value

Returns the documented result for the function signature.

Example

respond {
  status = 200
  body = { total = length(steps.fetch_orders.result) }
}