Hello World to Production
Hello World to Production in 30 Minutes
Section titled “Hello World to Production in 30 Minutes”From first program to compiled binary - the complete journey.
Time: 30 minutes Level: Absolute Beginner Prerequisites: None (we start from zero!) What you’ll build: A working command-line program that compiles to native code
Minute 0-5: Installation & Setup
Section titled “Minute 0-5: Installation & Setup”Install Janus
Section titled “Install Janus”# Download and install Januscurl -sSf https://janus-lang.org/install.sh | sh
# Verify installationjanus --version# Should show: Janus v0.2.6Create your project
Section titled “Create your project”# Create a new directorymkdir my-first-januscd my-first-janus
# Create your first programtouch hello.janMinute 5-10: Hello World
Section titled “Minute 5-10: Hello World”Write your first program
Section titled “Write your first program”Open hello.jan in your favorite editor:
// My first Janus program!
func main() do println("Hello, World!")endRun it
Section titled “Run it”janus run hello.janOutput:
Hello, World!Congratulations! You just ran your first Janus program!
Section titled “Congratulations! You just ran your first Janus program!”What happened:
func main() do...end- Entry point for your programprintln(...)- Prints text to terminal- Janus compiled it to native code and ran it
Minute 10-15: Variables & Types
Section titled “Minute 10-15: Variables & Types”Expand your program
Section titled “Expand your program”func main() do // Immutable variables (default) let name = "Janus" let version = 0.26
println("Welcome to ", name, " v", version)
// Mutable variables var count = 0 count = count + 1
print("Counter: ") print_int(count) println("")endWhat you learned:
letfor immutable variables (can’t change)varfor mutable variables (can change)- Type inference (Janus figures out types automatically)
- Multiple ways to print (
println,print,print_int)
Minute 15-20: Control Flow
Section titled “Minute 15-20: Control Flow”Add logic to your program
Section titled “Add logic to your program”func greet(name: []const u8, age: i64) do println("Hello, ", name, "!")
if age < 18 do println("You're a minor") else if age < 65 do println("You're an adult") else println("You're a senior") endend
func main() do greet("Alice", 25) greet("Bob", 70) greet("Charlie", 15)endWhat you learned:
- Function parameters with types
if...do...endconditional logicelse iffor multiple conditions
Minute 20-25: Loops & Iteration
Section titled “Minute 20-25: Loops & Iteration”Add iteration
Section titled “Add iteration”func print_fibonacci(count: i64) do var a = 0 var b = 1 var i = 0
println("Fibonacci sequence:")
while i < count do print_int(a) print(" ")
let temp = a + b a = b b = temp
i = i + 1 end
println("")end
func main() do print_fibonacci(10)
println("\nCounting with for:") for i in 0..5 do print_int(i) print(" ") end println("")endWhat you learned:
while...do...endloopsfor...inrange iteration0..5inclusive range (0,1,2,3,4,5)- Mutable state in loops
Minute 25-28: Compile to Binary
Section titled “Minute 25-28: Compile to Binary”Create a standalone executable
Section titled “Create a standalone executable”# Compile your programjanus build hello.jan -o hello
# Now you have a native binary!ls -lh helloOutput:
-rwxr-xr-x 1 user staff 50K Jan 29 12:00 helloRun the compiled binary
Section titled “Run the compiled binary”./helloWhat’s amazing:
- No runtime needed (unlike Python/JavaScript)
- Native machine code (like C/Rust)
- Fast startup (~1ms vs ~50ms for Python)
- Single file deployment
Minute 28-30: Deploy & Share
Section titled “Minute 28-30: Deploy & Share”Your program is production-ready!
Section titled “Your program is production-ready!”# Copy it anywherecp hello ~/bin/hello
# Run it from anywherehelloShare with others
Section titled “Share with others”# Send the binary to someone elsescp hello user@server:/usr/local/bin/
# They can run it immediately (no installation needed!)What makes this “production ready”:
- Compiled to native code
- No dependencies to install
- Cross-platform (Linux, macOS, Windows)
- Fast and lightweight
What You Accomplished in 30 Minutes
Section titled “What You Accomplished in 30 Minutes”- Installed Janus
- Wrote your first program
- Learned variables (let/var)
- Used control flow (if/else)
- Implemented loops (while/for)
- Compiled to native binary
- Created a deployable program
This is the power of Janus :core:
- Teaching-simple syntax
- Production-grade compilation
- Native performance
- Zero runtime dependencies
Next Steps
Section titled “Next Steps”Try these experiments:
Section titled “Try these experiments:”- Modify the Fibonacci program to calculate 20 numbers
- Add a new function that prints a multiplication table
- Create a number guessing game with user input
- Build a file reader (see Tutorial 4: Zig Integration)
Continue Learning:
Section titled “Continue Learning:”- Tutorial 2: [Building Your First CLI Tool]/tutorials/cli-tool/
- Tutorial 3: [Understanding Error Handling]/tutorials/error-handling/
- Tutorial 4: [Working with Zig Integration]/tutorials/zig-integration/
Key Takeaways
Section titled “Key Takeaways”What Janus :core is Great For:
Section titled “What Janus :core is Great For:”- Learning Programming - Clean, readable syntax
- Systems Programming - Native compilation, no GC
- CLI Tools - Fast compilation, single binary
- Algorithms - Teaching-friendly, production-fast
- Education - Python-simple, Rust-powerful
The Janus Philosophy:
Section titled “The Janus Philosophy:”“Where teaching simplicity meets native performance.”
You write code that reads like Python, but runs like C.
Congratulations! You’re now a Janus developer!
Next tutorial: Building Your First CLI Tool