Hello World
Your first program
Section titled “Your first program”Create a file called hello.praia:
print("Hello, World!")Run it:
praia hello.praiaBasic syntax
Section titled “Basic syntax”Praia uses familiar C-style syntax with some differences.
Variables
Section titled “Variables”Declare variables with let:
let name = "Praia"let version = 1let running = trueFunctions
Section titled “Functions”Define functions with func:
func greet(name) { print("Hello, %{name}!")}
greet("world")String interpolation
Section titled “String interpolation”Use %{expression} inside strings:
let lang = "Praia"print("%{lang} is fun!")Comments
Section titled “Comments”// single-line comment
/* multi-line comment */Semicolons
Section titled “Semicolons”Semicolons are optional. They are useful for one-liners:
praia -c 'let x = 1; let y = 2; print(x + y)'Running scripts
Section titled “Running scripts”praia script.praia # run a filepraia script.praia arg1 arg2 # with arguments (available via sys.args)praia -c 'print("inline")' # run a one-liner