Examples: Hello World
The classic first program in Lumen.
Basic Hello World
lumen
# hello.lm.md
cell main() -> String
return "Hello, World!"
endRun it:
bash
lumen run hello.lm.mdOutput:
Hello, World!With Greeting Function
lumen
cell greet(name: String) -> String
return "Hello, {name}!"
end
cell main() -> String
return greet("Lumen")
endInteractive with Input
lumen
cell main() -> Null
print("What is your name?")
# In a real scenario, you'd read input
let name = "World"
print("Hello, {name}!")
return null
endMarkdown Documentation
markdown
# Hello World Example
This is the classic first program.
```lumen
cell main() -> String
return "Hello, World!"
end
```
## How It Works
1. We define a `cell` (function) called `main`
2. It returns a `String`
3. The return value is printed automaticallyMultiple Greetings
lumen
cell main() -> String
let greetings = [
greet("World"),
greet("Lumen"),
greet("AI")
]
return join(greetings, "\n")
end
cell greet(name: String) -> String
return "Hello, {name}!"
endOutput:
Hello, World!
Hello, Lumen!
Hello, AI!