Array Comprehensions¶
Array comprehensions build arrays from other collections using a FOR
clause inside a literal【F:language/src/test/kotlin/v2/ebnf.txt†L122-L124】.
An optional IF
clause filters elements before they are added:
Comprehensions can also trail the element expression with a FOR EACH
clause.
This form is useful when the produced value is an object:
The object literal runs once for every t
in trs
, yielding an array of
transformer descriptors.