Variables
Variables
A variable, in Julia, is a name associated (or bound) to a value. It's useful when you want to store a value (that you obtained after some math, for example) for later use. For example:
# Assign the value 10 to the variable x julia> x = 10 10 # Doing math with x's value julia> x + 1 11 # Reassign x's value julia> x = 1 + 1 2 # You can assign values of other types, like strings of text julia> x = "Hello World!" "Hello World!"
Julia provides an extremely flexible system for naming variables. Variable names are case-sensitive, and have no semantic meaning (that is, the language will not treat variables differently based on their names).
julia> x = 1.0 1.0 julia> y = -3 -3 julia> Z = "My string" "My string" julia> customary_phrase = "Hello world!" "Hello world!" julia> UniversalDeclarationOfHumanRightsStart = "人人生而自由,在尊严和权利上一律平等。" "人人生而自由,在尊严和权利上一律平等。"
Unicode names (in UTF-8 encodi