# Functions inside loops

**URL:** <https://discourse.julialang.org/t/functions-inside-loops/22947>\
**Category:** General Usage\
**Created:** [April 9, 2019, 4:17am UTC](https://discourse.julialang.org/t/functions-inside-loops/22947 "2019-04-09T04:17:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [April 9, 2019, 4:59am UTC](https://discourse.julialang.org/t/functions-inside-loops/22947/2 "2019-04-09T04:59:25Z")

</div>

Hello and welcome! You didn’t actually post any code. If you are redefining functions inside a loop, you have to make sure those are anonymous functions, as named functions are defined once only.

See this related issue [Same code in if and else blocks, get UndefVarError only on else condition](https://discourse.julialang.org/t/same-code-in-if-and-else-blocks-get-undefvarerror-only-on-else-condition/11611)

---

_[View the full topic](https://discourse.julialang.org/t/functions-inside-loops/22947)._
