Hello World

GitHub   Edit on GitHub

Writing Your First Grain Program

It’s time to write your first Grain program! While simple, this program should verify that we have everything set up correctly.

The File Extension

All Grain files end with the extension .gr. Let’s create our first file and call it hello.gr.

The Code

The code for this program is fairly straightforward and should feel familiar from other languages.

// hello.gr
print("Hello, world!")

Running the Program

To run the program, we use the Grain CLI:

grain hello.gr

If everything is set up properly, we should see the message appear in the console.

This is a notification!