As a beginner in learning Julia, I am using the code below to get the smallest number in an array;
smallest = 100000
array = [2, 34, 5, 67, 8]
for i in array
if i < smallest
smallest = i
end
end
println(smallest)
I can successfully run the similar code in Python but when I run it in Julia, it throws an error:
ERROR: LoadError: UndefVarError: smallest not defined
Am I missing for-loop syntax in Julia?