Hello World in Julia

Published on 01 May 2019 (Updated: 02 May 2020)

Hello World in Julia

In this article, we tackle Hello World in Julia.

How to Implement the Solution

With the background out of the way, let’s get right into our implementation of Hello World in Julia:

println("Hello, World!")

And unsurprisingly, that’s it! We can implement Hello World in Julia in a single line.

Despite how easy the print functionality seems in Julia, there’s actually a lot going on. First of all, println makes a call to print with an added newline character.

The print function handles any sort of IO, so we could theoretically pass our string to any IO stream. In this case, we leave the default standard output.

Regardless, print makes a call to a function named show. At that point, I’m not sure what happens, but I suspect there’s some C-level call to printf. If you know, let me know in the comments.

How to Run the Solution

With our solution ready, we probably want to run it. Perhaps the easiest thing to do would be to take advantage of Julia’s online editor. Unfortunately, it appears sign up is required to use it, but it’s great for running some code snippets.

Alternatively, we can download the latest version of Julia. While we’re at it, we should probably get a copy of the Hello World in Julia solution. With everything read to go, navigate the command line to the folder containing the solution. Then, run the following:

julia hello-world.jl

That should execute the script. Don’t be afraid to leverage the Julia documentation if you get stuck.[^grifski_hwjulia_2018]

Further Reading