Your First Program
Let the interpreter write a starter script for you:
lumen --introduction
This creates helloworld.lmn in the current directory:
println('Hello, world!')
print('What`s your name? ')
name = inputStr()
greeting = 'Hello, ' .. name .. '!'
println(greeting)
Run it:
lumen helloworld.lmn
Hello, world!
What`s your name? Ryan
Hello, Ryan!
What happened
lumen helloworld.lmncompiled the script tohelloworld.lmn.binand immediately ran it. See CLI Reference to do the two steps separately.println('...')andprint('...')are built-in functions.printlnappends a newline,printdoes not.inputStr()reads one whitespace-delimited word from standard input and returns it, so it is used on the right-hand side of an assignment...joins strings. Numbers are converted automatically.
The backtick in What`s is only a habit: \' also works inside a single-quoted string. See Strings.
Next steps
- Generate the bundled programs with
lumen --examples <name>(see Examples). - Learn the language topic by topic.
- Step through the program with
lumen helloworld.lmn --debugger, see Interactive Debugger.