# Map.update inside for loop

**URL:** <https://forum.elixirforum.com/t/map-update-inside-for-loop/41295>\
**Category:** Resources Chat/Questions\
**Tags:** maps, loop\
**Created:** [July 28, 2021, 9:50am UTC](https://forum.elixirforum.com/t/map-update-inside-for-loop/41295 "2021-07-28T09:50:09Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![kalindkaria](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kalindkaria/32/23652_2.png) [@kalindkaria](https://forum.elixirforum.com/u/kalindkaria)\
**Post date:** [July 28, 2021, 10:22am UTC](https://forum.elixirforum.com/t/map-update-inside-for-loop/41295/4 "2021-07-28T10:22:25Z")

</div>

Thanks for your reply.  
But in my case, the `for` loop control or the `n` is controlled from some other function and I need to update the `sensor_data` variable based on the value of `n`.  
I did try using `Enum.reduce` before but they can’t with an external `for` loop as it takes the control of iterating `n` from `0..9`.

---

_[View the full topic](https://forum.elixirforum.com/t/map-update-inside-for-loop/41295)._
