# Question about UndefVarError in for loop

**URL:** https://discourse.julialang.org/t/question-about-undefvarerror-in-for-loop/25442
**Category:** New to Julia
**Created:** [June 19, 2019, 12:00pm UTC](https://discourse.julialang.org/t/question-about-undefvarerror-in-for-loop/25442 "2019-06-19T12:00:42Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [June 19, 2019, 1:18pm UTC](https://discourse.julialang.org/t/question-about-undefvarerror-in-for-loop/25442/2 "2019-06-19T13:18:05Z")

</div>

Please quote your code: [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530)

You need `global a = a + n` if you want to modify the global variable `a` from a for loop.

---

_[View the full topic](https://discourse.julialang.org/t/question-about-undefvarerror-in-for-loop/25442)._
