In this tutorial you will learn about the Julia Hello World Program and its application with practical example.
Julia Hello World Program
As usual we will start learning Julia programming by creating “Hello world!” program. The “Hello world!” program is a simplest program that will display some text on the screen. The “Hello world!” program is a simple yet complete program for beginners that illustrates the basic syntax of Julia programming language. The “Hello world!” program gives you a way to test systems and programming environment.
This tutorial will guide you through writing a basic “Hello World!” program in Julia. In Julia Programming, you can do this either by programming it directly in command prompt or you can simply write a program in a file and executing it.
Julia Command Prompt
Let’s open command prompt and run the following command to start the Julia Command prompt.
1 |
julia |
Or you can start Julia Shell directly from programs –
this will launch Julia GUI Shell as following –
Here, you can start writing your program. In Julia Command Prompt, you can print the “Hello World!” as following –
Example :-
1 |
println("Hello world!") |
Output:-
Julia Script File
Step 1:- Create a file called “hello_world.jl” using a text editor program of your choice. The .jl file extension is used to specify Julia file.
Step 2:- Let’s open the “hello_world.jl” file that we created, and put the following line of code in it and save it.
1 |
println("Hello World!") |
The println() is a function that tells the julia to display or output the content inside the parentheses.
Step 3:- Now, open terminal or command prompt and switch to the folder where our “hello_world.jl” file is saved. Run the program by typing the following command –
1 |
julia hello_world.jl |
Once the program is executed it will print “Hello World!” as below –
Output:-
1 |
Hello world! |
Note :- Before executing Julia Script in the command prompt, PATH has to be added to environment variables in advanced system properties.