Julia – Variables

In this lesson, you will learn about variables, variables declaration, and variables initialization in Julia. Examples will be provided to understand the topic better.

Variables in programming are memory locations allocated to store specific values. Their representation in the program is a name, usually something meaningful, such as employeeSalary.


Declaring variables in Julia

In Julia, variables do not require a datatype; Julia’s compiler auto assigns a datatype based on the value of a variable.

employeeSalary
employeeAge

Initializing variables in Julia

Variables in Julia can be initialized during their declaration.

employeeSalary = 500.00
employeeAge = 38

Variables naming rules in Julia

  • Variables in Julia can contain numbers, but they cannot begin with them.
  • Variables in Julia must start with a Letter, capital or lower case, or an underscore _.
  • The ! can be used in Julia’s variables, but variables cannot begin with it.
  • A good practice when declaring variables is to follow a specific case, such as camelCase or PascalCase

Things to Remember

  • A variable must start with a lower or upper case letter or an underscore.
  • Numbers and the symbol ! can be used in variables, but they cannot start with them.
  • A variable in Julia can be initialized at the time of declaration.
Back to: Julia Tutorial > Introduction to Julia

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.