# How to pass variable into loop?

**URL:** https://discourse.julialang.org/t/how-to-pass-variable-into-loop/25602
**Category:** New to Julia
**Tags:** question
**Created:** [June 24, 2019, 1:14pm UTC](https://discourse.julialang.org/t/how-to-pass-variable-into-loop/25602 "2019-06-24T13:14:38Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [June 24, 2019, 1:26pm UTC](https://discourse.julialang.org/t/how-to-pass-variable-into-loop/25602/2 "2019-06-24T13:26:42Z")

</div>

```julia
a = 10
for i in 1:100
  global a
  b = a*2
  a = b*0.1
end

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-pass-variable-into-loop/25602)._
