variables are identifiers to store the value, which can be used later for processing.

It contains the memory location of a variable that holds a value.

How to declare and initialize a variable in Julia

Julia contains variable declaration without a type

variable name is a valid identifier and not a reserved word.

Syntax

variable = value
# variable declaration
 
# assign number
number = 12
 
# assign string
name = "john"
 
# assign float number
f = -34
 
# operator as a variable name
- = "a"
 
# unicode variable name
$ = 30
 
println(number)
println(name)
println(f)
println(-)
println($)

Variable names rules and notes

  • Variables names start with a to z or A to Z, underscore, and special characters
  • Operators and Unicode names are allowed as variable name
  • Inbuilt keywords are not allowed as names