Mascara Try it Download Buy About Documentation Blog

Function types

Function types are type signatures which corresponds to a function signature. Only functions which match the parameter types and return types are compatible with the signature.

Function types are useful with higher order functions.

Syntax definition [Help]
function ( parametertypes ) [ : returntype ]
Example:
var t : (function(int):int);
By the above definition, t can only be assigned a function which matches the provided signature:
function f(a : int) { return a; }
t = f; // OK
   
function g(a : int) { }
t = g; // ERROR - g does not have the same return type