# By default, Julia returns the output
2 + 35
Marie-Hélène Burle
In this section, we explore the basics of Julia’s syntax.
Your turn:
What does ; at the end of a command do?
What is surprising about 2a?
What does += do?
What does .*do?
Your turn:
What does ! at the end of a function name do?

A variable is a name bound to a value:
It can be called:
Or used in expressions:
You can re-assign new values to variables:
Even values of a different type:
You can define multiple variables at once:
These names are extremely flexible and can use Unicode character:
Admittedly, using emojis doesn’t seem very useful, but using Greek letters to write equations really makes Julia a great mathematical language:
Note how the multiplication operator can be omitted when this does not lead to confusion.
Also note how the mathematical constant π is available in Julia without having to load any module.
If you want to know how to type a symbol, ask Julia: type ? and paste it in the REPL.
The only hard rules for variable names are:
if, do, try, else,π) and keywords in use in a session.We thus get an error here:
syntax: invalid assignment location "false" around /home/marie/parvus/prog/mint/julia/intro_basics.qmd:276 Stacktrace: [1] top-level scope @ ~/parvus/prog/mint/julia/intro_basics.qmd:276
In addition, the Julia Style Guide recommends to follow these conventions:
The keyword ans is a variable which, in the REPL, takes the value of the last computation:
10
To print the value of a variable in an interactive session, you only need to call it:
In non interactive sessions, you have to use the println function:
Note the difference between single and double quotes:
ParseError: # Error @ ]8;;file:///home/marie/parvus/prog/mint/julia/intro_basics.qmd#329:2\/home/marie/parvus/prog/mint/julia/intro_basics.qmd:329:2]8;;\ 'This is not a sring' #└─────────────────┘ ── character literal contains multiple characters Stacktrace: [1] top-level scope @ ~/parvus/prog/mint/julia/intro_basics.qmd:329
We got an error here since ' is used for the character type and can thus only contain a single character.
Comments
Comments do not get evaluated by Julia and are for humans only.