Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function Declarations

Functions are named global declarations, subject to the behavior described here.

Resultant Symbol

References to function declarations resolve to a function value.

Assertions

  1. Each parameter's type expression is a value of the type type.
  2. The return type's expression is a value of the type type.
  3. Each parameter's name is unique within the function.

Syntax

function_declaration_parameter = identifier, colon, expression ;

function_declaration_parameter_list = left_paren, [ function_declaration_parameter, { comma, function_declaration_parameter } ], right_paren ;

function_declaration = function, identifier, function_declaration_parameter_list, colon, expression, expression ;