function definition
FEEL language construct
function(param, param) expression
FEEL supports inline function definitions; functions are values and can be stored in a context entry and called by that name. This keeps a repeated sub-expression in one place inside a single literal expression, without needing a separate decision.
Syntax elements
| Element | Type | Description |
|---|---|---|
| param | name | parameter name, optionally with a type: name: number |
| expression | any | the body; parameters are in scope |
Examples
(function(a, b) a + b)(2, 3)
5
Try it ↑
{ add: function(a,b) a + b, r: add(2,3) }.r
5
Try it ↑
{ vat: function(net) net * 0.081, total: 100 + vat(100) }.total
108.1
Try it ↑
Related constructs
context literal {…} · for … in … return
Defined by the OMG DMN 1.6 specification, chapter 10.3 (the FEEL grammar and semantics).