# ERROR: LoadError: UndefVarError: fTerm1 not defined

**URL:** https://discourse.julialang.org/t/error-loaderror-undefvarerror-fterm1-not-defined/20937
**Category:** New to Julia
**Created:** [February 18, 2019, 2:32pm UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-fterm1-not-defined/20937 "2019-02-18T14:32:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Monkspeed](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/monkspeed/32/7131_2.png) [@Monkspeed](https://discourse.julialang.org/u/Monkspeed)
#### Post date: [February 18, 2019, 2:32pm UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-fterm1-not-defined/20937/1 "2019-02-18T14:32:24Z")

</div>

Hi all,

I’m new to programming with Julia, and I’m really stuck.

I keep getting an error that fTerm1 is not defined but it’s right there!  
Am I being incredibly dense??

```julia
using Printf
using Statistics

fSize = 10
i1 = 1
fTerm1 = 0
fTerm2 = 1

for i1 in fSize
    nextTerm = fTerm1 + fTerm2
    fTerm1 = fTerm2
    fTerm2 = nextTerm

```

Any help appreciated, thanks.

---

<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: [February 18, 2019, 2:32pm UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-fterm1-not-defined/20937/2 "2019-02-18T14:32:57Z")

</div>

You need `global` to modify a global variable from a loop.

---

<div class="post-metadata">

### Author: ![Monkspeed](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/monkspeed/32/7131_2.png) [@Monkspeed](https://discourse.julialang.org/u/Monkspeed)
#### Post date: [February 18, 2019, 2:44pm UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-fterm1-not-defined/20937/3 "2019-02-18T14:44:34Z")

</div>

I thought I was going nuts, thank you so much!
