Julia managed to surprise me today. I'm wondering how to understand what
happens in this case and if it's a side effect of some design decision or
syntax -- or a bug.
The following code executes without any errors
for i=1:5
for j=1:5
if i == j
blah
end
end
end
and "blah" can be anything you want! I discovered this because I had
for i=1:5
for j=1:5
if i == j
contine # continue mis-spelled
end
end
end
This code executes and runs when pasted into the console or as part of a
function in:
Julia-0.4 (in console and via ipython notebook), Julia-0.4.2 (on Juliabox)
and Julia-0.5-dev (on Juliabox)
What I would have expected is some type of error such as "blah" is not
defined, e.g.
julia> function myans()
blah
end
myans (generic function with 1 method)
julia> myans()
ERROR: UndefVarError: blah not defined
in myans at none:2
It seems like this is likely some type of design implication because:
julia> function myans()
blah
1
end
myans (generic function with 1 method)
julia> myans()
1
Any insights would be awesome for my own understanding!
Thanks,
David Gleich