Hello World in Julia
Julia is a high-level open-source programming language, developed by a group of 4 people at MIT. Julia is a dynamic, high-performance programming language that is used to perform operations in scientific computing. Similar to the R Programming Language, Julia is used for statistical computations and data analytics. Julia was built mainly because of its speed in programming, it has much faster execution as compared to Python and R.
Julia provides support for big data analytics by performing complex tasks such as cloud computing and parallelism, which play a fundamental role in analyzing Big Data.
Before we start to learn to code in Julia, let’s see from where we need to download the needed software and programs. Julia can be downloaded from its official website and can be installed with the help of How to install Julia on Windows and Linux?
At last, we need to have a text editor to write our code. Feel free to use any text editor like VS Code, Sublime Text, Notepad++, etc.
Hello World Program
Hello World is the most basic program that is used to show the basic syntax of a programming language. Here, in Julia, there are multiple ways to write and execute a code:
With Julia interactive session:
The easiest way to get started with Julia is by starting an interactive session (also known as a read-eval-print loop or “REPL”) by double-clicking the Julia executable or running Julia from the command line:
To print Hello World as the output in Julia interactive session, we can directly write “Hello World” with double quotes (” “), since we want to print a string so we need to insert it inside the double-quotes.
We can also use print() function, the print function is used to print data on the output screen, we just need to pass “Hello World” string as an argument in the print() function.
The difference between directly writing “Hello World” and writing it with the print function is that when we directly write “Hello World”, it will also print the quotes (” “) with the text but with the print function, it will only print text.
By creating a helloworld.jl file:
To print Hello World as the output in Julia, we need to create a file with name helloworld.jl. Then we can use the print function discussed above to print Hello World as the output, we just need to pass “Hello World” string as an argument in the print function.
Then run the file on command prompt or terminal with the command:
We can also use the println() function to print Hello World as the output, the only difference here is that it will end on a new line after printing the output on the screen.