jorts/examples/add.jt
Luna b3ac29fd3b add some stuff
i am a reasonable human being
2019-03-08 05:22:52 -03:00

23 lines
467 B
Text

import io
fn add (int a, int b) -> int {
a + b
}
// return type is void by default
fn main () {
// explicit types, or
int val = add(2, 2)
// type inferred from the functions' return value
val := add(2, 2)
// variables are immutable, however, you can update them with
// the value of the old one.
val = val + 1
// a shorthand is val++, same for val--.
// string interpolation is implicit
io.puts("2 plus 2 = {val}")
}