@assertions:len!
The decoded length of the dynamic return value of a call, on-chain: element count for arrays, byte length for string/bytes.
Returns: number
Syntax
Section titled “Syntax”@assertions:len!(call)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
call | address | A :: call expression (or chain) returning an array, string or bytes |
Examples
Section titled “Examples”load assertions
set $gov 0xc0dbDcA66a0636236fAbe1B3C16B1bD4C84bB1E1
# Top level: compiles to the core assert*CallArrayLength family (all six operators)assertions:assert @len!($gov::{voters()(address[])}) >= 3 "not enough voters"assertions:assert @len!($gov::{voters()(address[])}) != 0
# Nested: compiles to Combinators.arrayLengthCall, composable as a numberassertions:assert @num!(@len!($gov::{voters()(address[])}) * 2) > 4- For a string/bytes return the decoded length is the byte length (UTF-8 characters may span multiple bytes). For raw returndata size use @assertions:bytelen!.