# Possible bug?

**URL:** <https://discourse.julialang.org/t/possible-bug/93668>\
**Category:** New to Julia\
**Created:** [January 27, 2023, 10:59pm UTC](https://discourse.julialang.org/t/possible-bug/93668 "2023-01-27T22:59:26Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![x13420x](https://avatars.discourse-cdn.com/v4/letter/x/ecc23a/32.png) [@x13420x](https://discourse.julialang.org/u/x13420x)\
**Post date:** [January 27, 2023, 10:59pm UTC](https://discourse.julialang.org/t/possible-bug/93668/1 "2023-01-27T22:59:26Z")

</div>

```julia
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”

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [January 27, 2023, 11:03pm UTC](https://discourse.julialang.org/t/possible-bug/93668/2 "2023-01-27T23:03:40Z")

</div>

you never assign anything to `primel` except `[]`.  
` println(div(10,3)` needs another ')`  
I really don’t know what you are trying to test.

BigInts need to be used like this

```julia
ten = big(10)
three = big(3)
div(ten, three)
# or
div(big(10), big(3))

```

try `typeof(10), typeof(big(10))`

---

<div class="post-metadata">

**Author:** ![x13420x](https://avatars.discourse-cdn.com/v4/letter/x/ecc23a/32.png) [@x13420x](https://discourse.julialang.org/u/x13420x)\
**Post date:** [January 27, 2023, 11:06pm UTC](https://discourse.julialang.org/t/possible-bug/93668/3 "2023-01-27T23:06:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 27, 2023, 11:06pm UTC](https://discourse.julialang.org/t/possible-bug/93668/4 "2023-01-27T23:06:40Z")

</div>

> [@x13420x](#):
>
> 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

I can’t reproduce (in Julia 1.8.3), even if I uncomment everything:

```julia
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.)

---

<div class="post-metadata">

**Author:** ![x13420x](https://avatars.discourse-cdn.com/v4/letter/x/ecc23a/32.png) [@x13420x](https://discourse.julialang.org/u/x13420x)\
**Post date:** [January 27, 2023, 11:08pm UTC](https://discourse.julialang.org/t/possible-bug/93668/5 "2023-01-27T23:08:36Z")

</div>

it is broken for me on both pluto and replit…but pluto I have real code not this example thing

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 27, 2023, 11:08pm UTC](https://discourse.julialang.org/t/possible-bug/93668/6 "2023-01-27T23:08:57Z")

</div>

> [@x13420x](#):
>
> it is broken for me on both pluto and replit

What version of Julia are you using?

---

<div class="post-metadata">

**Author:** ![x13420x](https://avatars.discourse-cdn.com/v4/letter/x/ecc23a/32.png) [@x13420x](https://discourse.julialang.org/u/x13420x)\
**Post date:** [January 27, 2023, 11:10pm UTC](https://discourse.julialang.org/t/possible-bug/93668/7 "2023-01-27T23:10:19Z")

</div>

1.8.5…maybe that has something to do with it

---

<div class="post-metadata">

**Author:** ![x13420x](https://avatars.discourse-cdn.com/v4/letter/x/ecc23a/32.png) [@x13420x](https://discourse.julialang.org/u/x13420x)\
**Post date:** [January 27, 2023, 11:12pm UTC](https://discourse.julialang.org/t/possible-bug/93668/8 "2023-01-27T23:12:17Z")

</div>

[replit](https://replit.com) is fast to use maybe you can understand the errors it is throwing…You can use it without signing up for an account

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 27, 2023, 11:17pm UTC](https://discourse.julialang.org/t/possible-bug/93668/9 "2023-01-27T23:17:49Z")

</div>

> [@x13420x](#):
>
> 1.8.5…maybe that has something to do with it

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](https://discourse.julialang.org/t/possible-bug/93668/4)? As I commented above, your original post was not runnable (it had a typo), so maybe you are running something different.

---

<div class="post-metadata">

**Author:** ![x13420x](https://avatars.discourse-cdn.com/v4/letter/x/ecc23a/32.png) [@x13420x](https://discourse.julialang.org/u/x13420x)\
**Post date:** [January 27, 2023, 11:27pm UTC](https://discourse.julialang.org/t/possible-bug/93668/10 "2023-01-27T23:27:57Z")

</div>

Yeah that solved it …thank you for finding my bug

---

<div class="post-metadata">

**Author:** ![x13420x](https://avatars.discourse-cdn.com/v4/letter/x/ecc23a/32.png) [@x13420x](https://discourse.julialang.org/u/x13420x)\
**Post date:** [January 30, 2023, 7:52pm UTC](https://discourse.julialang.org/t/possible-bug/93668/11 "2023-01-30T19:52:20Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [February 2, 2023, 5:30pm UTC](https://discourse.julialang.org/t/possible-bug/93668/12 "2023-02-02T17:30:25Z")

</div>

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
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. ?

```

---

<div class="post-metadata">

**Author:** ![x13420x](https://avatars.discourse-cdn.com/v4/letter/x/ecc23a/32.png) [@x13420x](https://discourse.julialang.org/u/x13420x)\
**Post date:** [February 2, 2023, 6:33pm UTC](https://discourse.julialang.org/t/possible-bug/93668/13 "2023-02-02T18:33:24Z")

</div>

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”
