Skip to content

Your first Hydrogen project

Welcome! In this guide you will run your first Hydrogen program. You don’t need to know everything about programming to start.

Follow the installation guide for your platform. The published compiler’s documented native executable workflow is for Linux x86-64.

Open a terminal and confirm the hy command is available:

Terminal window
hy --help

Download hello.hy and save the file in a new folder. You can open it with a text editor.

Here is what the program looks like:

public class Program {
public static int Main(string[] args) {
System.Console.WriteLine("Hello, Hydrogen!");
return 0;
}
}

The Main method is where your program begins. WriteLine prints a message to your terminal. return 0 tells your computer that everything finished successfully.

Open a terminal in the same folder as hello.hy:

Terminal window
hy check hello.hy
hy compile hello.hy -o hello
chmod +x hello
./hello

You should see:

Hello, Hydrogen!

Change the text between the quotation marks, then compile and run the program again. Try printing a different message!

When you’re ready, download another sample or learn about variables and types. Have fun experimenting.