lang.function
Module lang.function
API
Definitions
The lang.function module corresponds to the function basic type.
function
function call( function() () func, any|error... args) returns any|error
function() ()
Calls a function dynamically.
If the arguments specified in args are not of the type required by func, then this will panic.
args
func
Copyfunction getGreeting(string? name = ()) returns string => name is () ? "Hello" : string `Hello ${name}!`; function:call(getGreeting) ⇒ Hello function:call(getGreeting, "David") ⇒ Hello David! function:call(getGreeting, 1) ⇒ panic
function getGreeting(string? name = ()) returns string => name is () ? "Hello" : string `Hello ${name}!`; function:call(getGreeting) ⇒ Hello function:call(getGreeting, "David") ⇒ Hello David! function:call(getGreeting, 1) ⇒ panic
Import
import ballerina/lang.function;
Metadata
Released date: about 1 year ago
Version: 2201.8.2
Compatibility
Platform: java17
Ballerina version: 2201.8.2
GraalVM compatible: Yes
Other versions