3.2 Basic concepts
- Values: Julia can work with different type of values like numbers, characters, strings, etc. Below, we see an example of an string value and a numeric value.
- Variables: A value can be assigned to a variable. Below, the variable
greet
is defined with the assigned value"Hello"
.
- Functions: To define a function, we start with the
function
key followed by the name of the function with braces, and it finish with theend
key. The output value can be explicitely defined using thereturn
key. See an example below.
- Printing: The most common function to print a text is
print
, whileprintln
has the same behaviour but adds a newline at the end. We can use$
to interpolate the value of a vairable. You can use braces for expressions (e.g.$(1 + 1)
). In the example below, variableswho
andgreet
are interpolated in the printed text.