Functions
A Klar function requires:
@Use("java")(mandatory today)- An explicit access modifier (currently only
publicis fully supported) - A return type
- A name
- Parameters (optional)
- An explicit return statement
Example: main
@Use("java")
public void main(){
println("Hello World From Klar!");
return null;
}
Example: typed function
@Use("java")
public integer sumOf(integer a, integer b){
return a + b;
}
Important restrictions (today)
@Use("java")is mandatory on all methods (design choice).- **
protected/internal**may exist as keywords, but onlypublicis guaranteed to transpile correctly today.