I read that global variables have a noticeable effect on performance.
To avoid them, I put everything inside the init function , as I read here .
Simple example: integer.jl:
function __init__()
n = 0
while n < 2
try
print("Insert an integer bigger than 1: ")
n = parse(Int8,readline(STDIN))
catch Error
println("Error!")
end
end
println(n)
end
When I run julia integer.jlfrom the command line, nothing happens. function main()doesn't work either.
What to do to make it work?
(Also, can you fix any errors, inefficient code, or non-idiomatic syntax?)
Pigna source
share