https://github.com/btbytes/1-hello-world
OCaml Riot Example Project
https://github.com/btbytes/1-hello-world
Last synced: about 2 months ago
JSON representation
OCaml Riot Example Project
- Host: GitHub
- URL: https://github.com/btbytes/1-hello-world
- Owner: btbytes
- Created: 2024-02-20T11:08:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-20T11:08:37.000Z (about 2 years ago)
- Last Synced: 2026-01-15T15:53:37.464Z (3 months ago)
- Language: Makefile
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `1-hello-world`
A project so basic that fits on a single line!
```ocaml
Riot.run @@ fun () -> print_endline "Hello, Joe!"
```
Every Riot program begins with a call to `Riot.run`. `Riot.run` takes a single
function as input, and _does not terminate_. This is because Riot programs are
expected to _run forever_.
If you want to terminate the Riot runtime, you can call `Riot.shutdown ()` from
anywhere in the program. Keep in mind that this will not await for all
processes to terminate. We will cover graceful-shutdowns of applications later
in this tutorial.
```ocaml
Riot.run @@ fun () ->
print_endline "Hello, Joe!";
Riot.shutdown ()
```
The smallest Riot program, that starts and ends immediately, is then:
```ocaml
Riot.(run shutdown)
```
## Next Steps
* the [next step](../2-spawn-process/) introduces you to Processes