# Generic Method with # Methods

**URL:** <https://discourse.julialang.org/t/generic-method-with-methods/35153>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 26, 2020, 5:00am UTC](https://discourse.julialang.org/t/generic-method-with-methods/35153 "2020-02-26T05:00:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtaylor306](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@jtaylor306](https://discourse.julialang.org/u/jtaylor306)\
**Post date:** [February 26, 2020, 5:00am UTC](https://discourse.julialang.org/t/generic-method-with-methods/35153/1 "2020-02-26T05:00:54Z")

</div>

What exactly does “with # methods” mean? Here are some results that really confuse me.

```julia
function sayhi(x,y)
    x+y
end

```

Result: sayhi (generic function with 3 methods)

```julia
function f(x,y)
    x+y
end

```

Result: f (generic function with 1 method)

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [February 26, 2020, 5:53am UTC](https://discourse.julialang.org/t/generic-method-with-methods/35153/2 "2020-02-26T05:53:09Z")

</div>

The number of methods is the number different possible places you end up when calling a function. This is because with multiple dispatch some functions (like +) are defined in many different ways for different type combinations.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [February 26, 2020, 6:22am UTC](https://discourse.julialang.org/t/generic-method-with-methods/35153/3 "2020-02-26T06:22:12Z")

</div>

Try to restart Julia. You may have some old definitions lying around.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 26, 2020, 1:34pm UTC](https://discourse.julialang.org/t/generic-method-with-methods/35153/4 "2020-02-26T13:34:43Z")

</div>

You can use `methods()` to see a list of the methods for a given function:

```julia
julia> function f(x, y)
         x + y
       end
f (generic function with 1 method)

julia> methods(f)
# 1 method for generic function "f":
[1] f(x, y) in Main at REPL[1]:2

julia> function f(x)
         x + 2
       end
f (generic function with 2 methods)

julia> methods(f)
# 2 methods for generic function "f":
[1] f(x) in Main at REPL[3]:2
[2] f(x, y) in Main at REPL[1]:2

```
