# Variable which disappear in a for

**URL:** https://discourse.julialang.org/t/variable-which-disappear-in-a-for/50304
**Category:** General Usage
**Tags:** question, loops
**Created:** [November 17, 2020, 3:48pm UTC](https://discourse.julialang.org/t/variable-which-disappear-in-a-for/50304 "2020-11-17T15:48:02Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)
#### Post date: [November 17, 2020, 4:25pm UTC](https://discourse.julialang.org/t/variable-which-disappear-in-a-for/50304/2 "2020-11-17T16:25:00Z")

</div>

see here:

> [@Julia's loop scope behavior differs from Fortran?](https://discourse.julialang.org/t/julias-weird-behavior-of-variables-in-for-loops/50275/23):
>
> EDIT: I get the exact same performance between them (and -march=native doesn’t seem to matter). Compiling with gfortran -O3 -march=native rootloop.f90 -shared -fPIC -o libloop.so gfortran -Ofast -march=native rootloop.f90 -shared -fPIC -o libloopfast.so Yields: julia\> using BenchmarkTools julia\> function loop(x,n) s = 0. for i in 1:n r = sqrt(i) s = s + x\*r end s end loop (generic function with 1 method) julia\> function loop…

---

_[View the full topic](https://discourse.julialang.org/t/variable-which-disappear-in-a-for/50304)._
