Write the First NAUX Program
Tutorial index · Linux install · Platform availability · Algorithms
Complete one host installation guide first.
1. Create hello.nx
Use any plain-text editor and save this UTF-8 source:
~ rite
!say "Hello, NAUX!"
~ end
Every complete learner program has one ~ rite entry block. ~ end closes a
block, and !say value prints one line.
2. Check without running
naux check hello.nx
A valid program exits successfully. A malformed program reports its source filename, line, column, source excerpt, and caret.
3. Run
naux run hello.nx
Expected output:
Hello, NAUX!
4. Variables, functions, and decisions
~ fn absolute($value)
~ if $value < 0
^ -$value
~ else
^ $value
~ end
~ end
~ rite
$value = read_int()
!say absolute($value)
~ end
$namedenotes a variable.~ fn name($argument)defines a function before~ rite.^ expressionreturns from a function.~ if,~ else, and~ endexpress a decision.- Conditions must be boolean.
- Direct recursion is available within explicit work and call-depth limits.
Run it directly and enter -42 when NAUX asks for input:
naux run absolute.nx
For judge-style input, naux run absolute.nx < input.txt remains deterministic.
Expected output is 42.
Continue with algorithm exercises.