Skip to content

Hello World

The first thing you need to learn in any programming language is the famous Hello World! program.

In Crystal this is pretty simple, maybe a little bit boring:

puts "Hello World!"

Tip

You can build and run code examples interactively in this tutorial by clicking the Run button (thanks to carc.in). The output is shown directly inline.

If you want to follow along locally, follow the installation and getting started instructions.

Info

The name puts is short for “put string”.

The entire program consists of a call to the method puts with the string Hello World! as an argument.

This method prints the string (plus a trailing newline character) to the standard output.

All code in the top-level scope is part of the main program. There is no explicit main function as entry point to the program.