Hello World is the first program to code and run for learning any new programming language

This tutorial explains about below things

  • How to write a Hello World
  • How to compile and run the Hello World program

How to write a Julia Hello World program

  • Open any text editor such as VSCode
  • Create a new file hello.jl program, jl is a Julia file extension.
  • add below code to the file hello.jl:
\# Hello World first program
println("hello world first program")

The above program contains two parts

  • Comments

comments contain text, that starts with #. It is written for developers, and ignored by the Julia compiler.

  • Print statement

println is a function that prints a string to the console.

Now, You have written a Hello World program.

It’s time to run and compile the program.

How to run and compile the Julia program

We can run the Julia code in two ways

  • using the command line

Julia installation comes with a Julia compiler that runs the code and output to the console.

A:\Julia\work> Julia hello.jl
hello world first program
  • REPL interactive session

Type Julia in the command line, REPL sessions open and run include("hello.jl")

Here is a command output:

A:\Julia\work>julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.5 (2023-01-08)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia>

julia> include("hello.jl")
hello world first program

julia>