# Why pass variable into fiber(spawn) in a loop not work?

**URL:** <https://forum.crystal-lang.org/t/why-pass-variable-into-fiber-spawn-in-a-loop-not-work/5083>\
**Category:** Help & Support\
**Created:** [November 5, 2022, 3:42pm UTC](https://forum.crystal-lang.org/t/why-pass-variable-into-fiber-spawn-in-a-loop-not-work/5083 "2022-11-05T15:42:04Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![straight-shoota](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/straight-shoota/32/36_2.png) [@straight-shoota](https://forum.crystal-lang.org/u/straight-shoota)\
**Post date:** [November 5, 2022, 4:11pm UTC](https://forum.crystal-lang.org/t/why-pass-variable-into-fiber-spawn-in-a-loop-not-work/5083/3 "2022-11-05T16:11:43Z")

</div>

`while` does not create a new scope. So `_i` is closured and shared within the entire top-level scope.

---

_[View the full topic](https://forum.crystal-lang.org/t/why-pass-variable-into-fiber-spawn-in-a-loop-not-work/5083)._
