functionBody

The implementation of a function definition. Contains a single expression whose value is returned when the function is invoked. Functions whose body is the keyword external are implemented by the host environment.

Examples

Simple arithmetic body

define function "Square"(x Integer) returns Integer:
  x * x

Query expression as body

define function "ActiveConditions"() returns List<Condition>:
  [Condition] C where C.clinicalStatus ~ "Active"

Conditional body

define function "Label"(score Integer) returns String:
  if score >= 90 then 'high' else 'normal'
Railroad Diagram
100%
expression

scroll to zoom · drag to pan · click green rules or blue tokens to navigate

EBNF

functionBody
  : expression
  ;

Used In