Welcome to AK CODE! In this tutorial, you'll write and run your first program.
- How to write a simple AK CODE program
- How to compile it with the AK CODE compiler
- How to run the compiled binary
Create a file called hello.ak:
# My first AK CODE program
## This program says hello to the world
let name = "World"
show "Hello" name
let age = 30
show "You are" age "years old"
let score = 95.5
show "Your score is" score
If you've built the bootstrap compiler:
./build/akc hello.ak -o helloOr if using the self-hosted compiler:
akc hello.ak -o helloLinux:
./helloWindows:
hello.exeHello World
You are 30 years old
Your score is 95.5
#starts a comment — it's ignored by the compiler##is a documentation commentlet name = "World"creates a variable callednamewith the value"World"show "Hello" nameprints "Hello" followed by the value ofname- Numbers like
30and95.5don't need quotes - Multiple values in
showare printed with spaces between them
- Try changing the values and see what happens
- Add a second
showstatement - Try the Web App Tutorial to build a web server