-
Language:
English
-
Language:
English
10.2. Function Declaration Example
A typical function declaration looks like this:
function String hello(String name) { return "Hello "+name+"!"; }
Note
Note that the
function
keyword is used, even though it's not technically part of Java. Parameters to the function are defined as for a method. You don't have to have parameters if they are not needed. The return type is defined just like in a regular method.