using Base
global primel = []
println(primel)
println(div(10,3))
if true
println(primel)
println(div(10,3))
if true
println(primel)
println(div(10,3))
if true
println(primel)
println(div(10,3)
if true
println(primel)
#println(div(10,3))
if true
println(primel)
#println(div(10,3))
if true
println(primel)
##println(div(10,3))
end
end
end
end
end
end
I am using div with bigints but when the scoping gets deep it no longer recognizes the div function…is this bug or a feature
In pluto it throws “UndefVarError: div not defined”
Okay thanks but if you run the sample code it wont work…even with ints…if you comment out the fourth div then it will work…could be something with the Base library or with Julia itself…dont know I am new here…I could make my own function for division as a temporary solution
I can’t reproduce (in Julia 1.8.3), even if I uncomment everything:
julia> using Base
julia> global primel = []
Any[]
julia> println(primel)
Any
[]
julia> println(div(10,3))
3
julia> if true
println(primel)
println(div(10,3))
if true
println(primel)
println(div(10,3))
if true
println(primel)
println(div(10,3))
if true
println(primel)
println(div(10,3))
if true
println(primel)
println(div(10,3))
if true
println(primel)
println(div(10,3))
end
end
end
end
end
end
Any[]
3
Any[]
3
Any[]
3
Any[]
3
Any[]
3
Any[]
3
(Note that your original post was missing a close parenthesis on one line.)
Nope, I just upgraded to 1.8.5 and it still works fine, in both the REPL and in Pluto.
Are you sure you are running exactly the same code as in my post? As I commented above, your original post was not runnable (it had a typo), so maybe you are running something different.
The problem with my main program was I had a variable named div…so when I called the function div…the compliler had a breakdown. Now I am using the integer division operator and also changed the name of my variable…
That’s not “the compiler having a breakdown”, that’s the language telling you fairly specifically what’s wrong (you tried to call an integer):
julia> div = 123
123
julia> div(2, 3)
ERROR: MethodError: objects of type Int64 are not callable
Maybe you forgot to use an operator such as *, ^, %, / etc. ?
Actually I got variable undefined…which was confusing …sometimes it recognised it as a function and other times it thought it was a variable…mostly as the scoping got deeper…since I am porting My code I didnt know I had a variable “div”