Functions

Example

This is the simplest function which is named example, takes no parameters and returns a number of type int.

function example(): int {
  return 12
}

Return statement

Return statement consists of return keyword and an expression.

Supported expression types:

  • number

Definition

function <name>(<param1>: <param_type>, ...): <return_type> {
  return <expression>
}

If function return type is specified as void then return statement is obsolete.

Last updated

Was this helpful?