;
We add ;
to suppress output returned. For example let’s compare two codes with and without ;
at the end. x=2
would return 2
in the console as an output while x=2;
will not return anything in the console.
enumerate()
enumerate()
returns both the index and the value of an element in an array.
collect(enumerate(countries))
Output:
(1, "Korea")
(2, "Japan")
(3, "China")
countries = ("Korea", "Japan", "China")
for (index, country) in enumerate(countries)
println("Country $(country) in index $(index)")
end
Output:
Country Korea in index 1
Country Japan in index 2
Country China in index 3
Reference
https://julia.quantecon.org/getting_started_julia/julia_essentials.html