Last Updated by
As always, welcome back to another edition of Hello World in Every Language. Today, we’re looking to play around with Hello World in Julia, a numerical analysis language which first appeared in 2012.
Table of Contents
Despite being a relatively new language, Julia has a Wikipedia page. As a result, I won’t have to dig too much to learn about the language.
At any rate, Julia is a computational science language which fills a niche similar to Python and R. In fact, like Python, Julia can be used for general-purpose programming.
One of Julia’s interesting features is multiple dispatch, something that is lacking in Python. Roughly speaking, multiple dispatch allows a user to define multiple functions with the same name but different combinations of arguments.
In addition, Julia is capable of calling C and Python functions directly. Personally, I think that’s a fun little feature considering Julia is compiled at runtime. So, it gets C-like performance as well—perfect for numerical analysis.
Finally, Julia has metaprogramming features, so the language can be modified as needed by the user. If Julia ever takes off, we can probably expect several different dialects of it to emerge.
Hello World in Julia
With the background out of the way, let’s get right into our implementation of Hello World in Julia:
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
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:
That should execute the script. Don’t be afraid to leverage the Julia documentation if you get stuck.
Sample Programs in Every Language
Well, thanks again for sticking around. I’m having a lot of fun with these new languages, so I’ll probably keep the trend going for a few days.
If you liked this article, don’t forget to share it. Also, feel free to recommend future languages in the comments. See you next time!