Reputation: 71
This is my code:
using Printf
using Statistics
age = 12
if age < 10
println("$age")
This is the error:
ERROR: LoadError: syntax: incomplete: premature end of input
Stacktrace:
[1] top-level scope at D:\julia\trial.jl:5
[2] include(::Module, ::String) at .\Base.jl:377
[3] exec_options(::Base.JLOptions) at .\client.jl:288
[4] _start() at .\client.jl:484
in expression starting at D:\julia\trial.jl:5
It works well if I remove the if statement and just print the value of age.
Upvotes: 3
Views: 6384
Reputation: 31342
Julia terminates its blocks with an end
keyword (and does not rely on whitespace to define its blocks).
age = 12
if age < 10
println("$age")
end
Upvotes: 9