Skip to content

Functions

Sami edited this page Oct 30, 2025 · 2 revisions

To run your Kong program, you first need a main function.

In Kong, functions are designed like this: Funk name(params) -> returnType {body}

The main function is prototyped like this:

Funk main() -> Int {
  print("Hello World");
  Return 0;
} // -> Helllo World

You can assign return values of functions to the variables you create:

Funk add(Int: a, Int: b) -> Int {
  Return a + b;
}

Funk main() -> Int {
  Int a = 6;
  Int b = 7;
  Int sum = add(a, b);
  
  print(sum);
}
// -> 13

Clone this wiki locally