Commands
Run in the browser
Click the
All code blocks are editable.
Run from the command line
This assumes you have downloaded and installed keen.
Copy the example above and save to a file hello.keen.
Then run: keen hello.keen
Since the file includes a shebang, you can also run
chmod +x hello.keen , then ./hello.keen .
If a file is named main.keen,
you can use keen run dirname as shorthand for keen run dirname/main.keen .
(You can't use just keen dirname since that looks like a builtin command.)
Build to a JAR
keen build hello.keen generates an executable JAR file named hello .
You can then run it using ./hello .
(On some systems you must run java -jar hello .)
Build to JavaScript
keen build hello.keen --out hello.js generates a standalone JavaScript module.
The result can be loaded in a browser using: <script type="module" src="/hello.js"></script>
It can also be run with node hello.js (assuming you didn't use any browser-only APIs).
Ahead-of-time errors
Keen is a statically typed language and logs errors ahead-of-time as much as possible.
For convenience, most ahead-of-time errors don't prevent the program from starting.
Instead, they throw an exception at runtime if the code is reached.
To see all ahead-of-time errors without running the program, use keen check hello.keen.