Declares the beginning of a function.
Function Identifier: ReturnType ( Parameters )
Statements...
End [ Function ]
The Function keyword begins the declaration of a function.
Please see the Functions section of the monkey language reference for more information on functions.
End
Language reference (Functions)
Language reference (Strict mode)
The Main function, required by all monkey programs.
Function Main () Print "Hello"EndThe closing keyword End may be replaced with End Function if preferred:
Function Main () Print "Hello"End FunctionThe Main function in Strict mode; requires Int return type and Return statement.
StrictFunction Main:Int () Print "Hello" Return 0EndA function that returns the result of adding two floating-point values.
Function AddFloats:Float (value1:Float, value2:Float) Return value1 + value2EndPrint AddFloats (1, 2)For functions that don't return a value in Strict mode, the Void return type must be specified in the function declaration.
StrictFunction PrintMessage:Void (message:String) Print messageEnd