roc/examples/hello-world
2022-07-07 03:26:42 +02:00
..
platform dealloc is wrong for static strings 2022-07-07 03:26:42 +02:00
.gitignore Rename "hello" executable to "helloWorld" 2022-06-27 00:06:37 -06:00
main.roc Rename "hello" executable to "helloWorld" 2022-06-27 00:06:37 -06:00
README.md Separate hello-world platform switching into its own example 2022-06-27 00:06:33 -06:00

Hello, World!

To run, cd into this directory and run this in your terminal:

roc run

This will run main.roc because, unless you explicitly give it a filename, roc run defaults to running a file named main.roc. Other roc commands (like roc build, roc test, and so on) also default to main.roc unless you explicitly give them a filename.

About this example

This uses a very simple platform which does nothing more than printing the string you give it.

The line main = "Hello, World!\n" sets this string to be "Hello, World!" with a newline at the end, and the lines packages { pf: "platform/main.roc" } and provides [main] to pf specify that the platform/ directory contains this app's platform.