# Nested functions pros and cons

**URL:** https://discourse.julialang.org/t/nested-functions-pros-and-cons/19417
**Category:** General Usage
**Created:** [January 9, 2019, 10:31am UTC](https://discourse.julialang.org/t/nested-functions-pros-and-cons/19417 "2019-01-09T10:31:21Z")
**Posts on this page:** 1
**Showing post:** 24

<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: [January 10, 2019, 4:15pm UTC](https://discourse.julialang.org/t/nested-functions-pros-and-cons/19417/24 "2019-01-10T16:15:21Z")

</div>

> [@bennedich](#):
>
> I don’t have anything against `goto` s per se, but I’ve met a lot of programmers, even experienced ones, who have a very strong aversion to them, and will consider any usage of `goto` a sign of poor quality code and a lazy/inexperienced developer.

I suspect that most of this comes from Dijkstra’s “Go To Considered Harmful” essay, which people read and parrot without understanding the context. At the time this paper was written, structured control flow was a brand new concept and goto was how _all_ control flow was done in practice. Dijkstra was trying to convince people to use structured control flow _at all_ not convince them that they shouldn’t ever use goto.

The occasional, judicious use of goto is just fine, but (as always) consider the alternatives. If I can use a couple of gotos and have much clearer simpler code, that’s way better than writing the same thing with no gotos but a nasty, unintelligible mess of structured control flow—and there are some cases where this is the choice. The whole argument against goto was that unbridled use of it lead to complex unintelligible code, but readability and maintainability is the end goal by whatever means.

---

_[View the full topic](https://discourse.julialang.org/t/nested-functions-pros-and-cons/19417)._
