# Can I make a Function Call Itself?

**URL:** <https://discourse.julialang.org/t/can-i-make-a-function-call-itself/64067>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [July 5, 2021, 9:41am UTC](https://discourse.julialang.org/t/can-i-make-a-function-call-itself/64067 "2021-07-05T09:41:21Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Post date:** [July 5, 2021, 7:24pm UTC](https://discourse.julialang.org/t/can-i-make-a-function-call-itself/64067/11 "2021-07-05T19:24:12Z")

</div>

```julia
function myrecursion(depth::Int,arg)
    if depth>=2
        return nothing 
    else 
        println(arg)
        @info("myrecursion was called (depth=$(depth))")
        return myrecursion(depth+1,arg)
    end
end

myrecursion(0,"foo")
0

```

---

_[View the full topic](https://discourse.julialang.org/t/can-i-make-a-function-call-itself/64067)._
