# \#while-for-scope

**URL:** https://discourse.julialang.org/tag/while-for-scope/743.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [\`local\` just in case: good idea or code smell?](https://discourse.julialang.org/t/local-just-in-case-good-idea-or-code-smell/115668)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 8\
**Last updated:** [June 16, 2024, 3:55am UTC](https://discourse.julialang.org/t/local-just-in-case-good-idea-or-code-smell/115668 "2024-06-16T03:55:03Z")

</div>

I often write local to ensure a variable does not accidently reuse another definition such as in the example below. Is that a good idea, or is there something more sophisticated I should be doing to test local scoping? f…

---

## [Global variable issue](https://discourse.julialang.org/t/global-variable-issue/108288)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 28\
**Last updated:** [January 4, 2024, 6:24am UTC](https://discourse.julialang.org/t/global-variable-issue/108288 "2024-01-04T06:24:20Z")

</div>

It is quite strange that with the following code N = 10 M = 10 dim = binomial(N+M-1, M-1) basis=zeros(Int8, M, dim) basis\[1,1\]=N s=1 while basis\[M,s\]\<N s1=M-1 while basis\[s1,s\]==0 s1=s1-1 end …

---

## [How do I append row vectors into an array when I don't know the exact dimension of the array before calculations end?](https://discourse.julialang.org/t/how-do-i-append-row-vectors-into-an-array-when-i-dont-know-the-exact-dimension-of-the-array-before-calculations-end/103762)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 4\
**Last updated:** [September 11, 2023, 11:27pm UTC](https://discourse.julialang.org/t/how-do-i-append-row-vectors-into-an-array-when-i-dont-know-the-exact-dimension-of-the-array-before-calculations-end/103762 "2023-09-11T23:27:24Z")

</div>

I’m using a while statement to carry out calculations for as long as a condition holds. At every iteration, I calculate a vector v. I want to append every new v vector as a row vector to the previous v vector. The probl…

---

## [I have no idea what's wrong. Please help! ERROR: UndefVarError: i not defined](https://discourse.julialang.org/t/i-have-no-idea-whats-wrong-please-help-error-undefvarerror-i-not-defined/65416)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 6\
**Last updated:** [July 28, 2021, 6:00pm UTC](https://discourse.julialang.org/t/i-have-no-idea-whats-wrong-please-help-error-undefvarerror-i-not-defined/65416 "2021-07-28T18:00:04Z")

</div>

I hvave no idea what wrong . Please help! julia\> for i=1:length(przedzaly)-1 var\_name=Symbol("lista\_polaczona\_" \* string(litery\[i\])) println(var\_name) @eval $var\_name=lista\[przedzaly\[i\]+1:przedzaly\[…
