FEEL

for … in … return

FEEL language construct

for name in list return expression

FEEL's iteration construct, the equivalent of a map or a for loop in other languages. It evaluates the return expression once per element and collects the results into a new list; it never mutates anything. Several iteration contexts separated by commas produce the cartesian product, and a range can be iterated directly instead of a list.

Syntax elements

ElementTypeDescription
namenamethe iteration variable, visible inside the return expression
listlist or rangewhat to iterate; a..b iterates the integers of a range
returnanyevaluated per element; results are collected into a list

Examples

for i in [1,2,3] return i * 2
[2, 4, 6] Try it ↑
for i in 1..4 return i * i
[1, 4, 9, 16] Try it ↑
for x in [1,2], y in [10,20] return x + y
[11, 21, 12, 22] Try it ↑
for c in ["a","b"] return upper case(c)
[A, B] Try it ↑

Related constructs

list filter […] · some … satisfies · every … satisfies

Related functions

count · sum

Defined by the OMG DMN 1.6 specification, chapter 10.3 (the FEEL grammar and semantics).