# To all noobs like me please read Bogumił Kamiński's blog especially the latest about why he uses main()

**URL:** <https://discourse.julialang.org/t/to-all-noobs-like-me-please-read-bogumil-kaminskis-blog-especially-the-latest-about-why-he-uses-main/84485>\
**Category:** New to Julia\
**Created:** [July 19, 2022, 6:31pm UTC](https://discourse.julialang.org/t/to-all-noobs-like-me-please-read-bogumil-kaminskis-blog-especially-the-latest-about-why-he-uses-main/84485 "2022-07-19T18:31:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon69491625](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Post date:** [July 19, 2022, 6:31pm UTC](https://discourse.julialang.org/t/to-all-noobs-like-me-please-read-bogumil-kaminskis-blog-especially-the-latest-about-why-he-uses-main/84485/1 "2022-07-19T18:31:04Z")

</div>

Hi all

I would suggest that a LOT my MANY mistakes in julia would have been avoided by reading Bogumił Kamiński’s blog entries. They are FUN, easy to read and informative. This latest one knocks it out of the ball park for me.

> **[Why do I use main function in my Julia scripts? | juliabloggers.com](https://www.juliabloggers.com/why-do-i-use-main-function-in-my-julia-scripts/)**
>
> Introduction

hope this helps

theakson

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [July 19, 2022, 8:31pm UTC](https://discourse.julialang.org/t/to-all-noobs-like-me-please-read-bogumil-kaminskis-blog-especially-the-latest-about-why-he-uses-main/84485/2 "2022-07-19T20:31:49Z")

</div>

If anyone’s wondering why a `let` block version doesn’t perform as well as a `main` method call despite both being local scopes, it’s because the compiler only optimizes and caches a method call. After all, a method call can be repeated throughout a script, and the `let` block cannot (you can rerun a script, but since the script can be edited between runs, it’s doing something new, not being saved).

---

<div class="post-metadata">

**Author:** ![colintbowers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/colintbowers/32/8033_2.png) [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Post date:** [July 20, 2022, 5:25am UTC](https://discourse.julialang.org/t/to-all-noobs-like-me-please-read-bogumil-kaminskis-blog-especially-the-latest-about-why-he-uses-main/84485/3 "2022-07-20T05:25:29Z")

</div>

For those interested, he has a [textbook](https://bkamins.github.io/julialang/2022/03/18/manning.html).

---

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [July 20, 2022, 9:57am UTC](https://discourse.julialang.org/t/to-all-noobs-like-me-please-read-bogumil-kaminskis-blog-especially-the-latest-about-why-he-uses-main/84485/4 "2022-07-20T09:57:16Z")

</div>

All the time-consuming loops and comprehensions should be wrapped into functions. Usually I end up writing many functions instead of just one `main()` function.
