Hello World
Let's write your first Keel program!
Using the REPL
The easiest way to try Keel is using the REPL (Read-Eval-Print Loop):
keel repl
Once in the REPL, type:
"Hello, World!"
Try itYou should see:
"Hello, World!"
Your First Function
Let's define a function that greets someone by name:
fn greet : String -> String
fn greet name = "Hello, " ++ name ++ "!"
greet "World"
Try itThis outputs:
"Hello, World!"
Breaking It Down
fn greet : String -> String- This declares a function namedgreetthat takes aStringand returns aStringfn greet name = ...- This defines the function body, wherenameis the parameter++- This is the string concatenation operator
Next Steps
- Learn more about the basics of Keel
- Explore functions in depth
- Try the playground to experiment online