# Help with ::

**URL:** <https://discourse.julialang.org/t/help-with/98544>\
**Category:** New to Julia\
**Created:** [May 9, 2023, 11:35am UTC](https://discourse.julialang.org/t/help-with/98544 "2023-05-09T11:35:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VISHWARATH\_T](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vishwarath_t/32/49212_2.png) [@VISHWARATH\_T](https://discourse.julialang.org/u/VISHWARATH_T)\
**Post date:** [May 9, 2023, 11:35am UTC](https://discourse.julialang.org/t/help-with/98544/1 "2023-05-09T11:35:15Z")

</div>

Hello,

I am executing the following function, and it should only accept Int64 as the argument. However, I find that it does not throw an error when any other data types like float is used. Can anyone pls clarify? C is a dataframe with two columns  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/e/5e7ad6a09f7066876920212ac524c8a3459d623e.png)

**function num\_lang(year::Int64)**  
\*\* boo=C[:,:year].==year\*\*  
\*\* return(count(boo))\*\*  
**end**

---

<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:** [May 9, 2023, 11:51am UTC](https://discourse.julialang.org/t/help-with/98544/2 "2023-05-09T11:51:55Z")

</div>

> [@VISHWARATH\_T](#):
>
> However, I find that it does not throw an error when any other data types like float is used.

Probably you are in a running Julia session where you previously defined a version of `num_lang` that didn’t have the type restriction, and it’s still in memory, so the old version is being called instead of `num_lang(::Int)`. Restart Julia and it should work as expected.

PS. Quote your code (and don’t post screenshots): [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757)

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [May 9, 2023, 12:08pm UTC](https://discourse.julialang.org/t/help-with/98544/3 "2023-05-09T12:08:52Z")

</div>

I agree with the answer of stevengj… most likely you had already defined a more broad version of `num_lang`.

If you try on a new Julia session you will see that the version you posted “accepts” only integer parameters, throwing a `MethodError` otherwise:

```julia
julia> function num_lang(year::Int64)
         println("I am in num_lang(::Int64)")
       end
num_lang (generic function with 1 method)

julia> num_lang("one")
ERROR: MethodError: no method matching num_lang(::String)

Closest candidates are:
  num_lang(::Int64)
   @ Main REPL[1]:1

Stacktrace:
 [1] top-level scope
   @ REPL[2]:1

julia> num_lang(1)
I am in num_lang(::Int64)

```
