Hello World
Let’s break down the hello world program:
fn main() -> i64 {
print("Hello, world!\n")
ret 0
}fn main() -> i64
Every Jda program starts with a main function that returns an i64 (64-bit integer). The return value becomes the process exit code — 0 means success.
print("Hello, world!\n")
print is a built-in function that writes a string to stdout. The \n is a newline escape sequence.
ret 0
ret is the return keyword in Jda. It returns the value 0 from main.
Variables
fn main() -> i64 {
let name: &i8 = "Jda"
print("Hello, ")
print(name)
print("!\n")
ret 0
}Variables are declared with let. The type &i8 is a pointer to bytes — this is how strings are represented in Jda.
Functions
fn greet(name: &i8) {
print("Hello, ")
print(name)
print("!\n")
}
fn main() -> i64 {
greet("world")
greet("Jda")
ret 0
}Functions are defined with fn. Functions that don’t return a value omit the -> Type annotation.