# Global declared variable reverting to declared value in loop

**URL:** <https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767>\
**Category:** Programming\
**Created:** [July 25, 2022, 3:52am UTC](https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767 "2022-07-25T03:52:43Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![allanpog](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@allanpog](https://forum.arduino.cc/u/allanpog)\
**Post date:** [July 25, 2022, 1:39pm UTC](https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767/21 "2022-07-25T13:39:41Z")

</div>

…and 100 sheets print of half a line each for a thirty-line code.

Cheers, Allan

---

<div class="post-metadata">

**Author:** ![allanpog](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@allanpog](https://forum.arduino.cc/u/allanpog)\
**Post date:** [July 25, 2022, 1:46pm UTC](https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767/22 "2022-07-25T13:46:23Z")

</div>

I like your tag. I too have often felt like I was kept in the dark and fed on BS. Eventually I became the expert and switched to being the drip under pressure. ‘Twas fun, but. I once spent an entire evening at a friend’s place trying to make sense of their Commador 64. My first home pc ran DOS3. Now all my kids make their living through the things. Going back to a micro-controller is an exercise in simplification and elegance.

Cheers, Allan

---

<div class="post-metadata">

**Author:** ![allanpog](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@allanpog](https://forum.arduino.cc/u/allanpog)\
**Post date:** [July 25, 2022, 1:48pm UTC](https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767/23 "2022-07-25T13:48:59Z")

</div>

Looks interesting, I’ll check it out.

Cheers, Allan

---

<div class="post-metadata">

**Author:** ![anon29197695](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@anon29197695](https://forum.arduino.cc/u/anon29197695)\
**Post date:** [July 25, 2022, 7:48pm UTC](https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767/24 "2022-07-25T19:48:10Z")

</div>

Allan a look at Nick Gammon's tips tricks and style guide. I have adopted most of his style tips and find it helps.

[https://www.gammon.com.au/forum/?id=12153](https://www.gammon.com.au/forum/?id=12153)

---

<div class="post-metadata">

**Author:** ![allanpog](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@allanpog](https://forum.arduino.cc/u/allanpog)\
**Post date:** [July 26, 2022, 1:00am UTC](https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767/25 "2022-07-26T01:00:02Z")

</div>

Good stuff in there, thanks.

---

<div class="post-metadata">

**Author:** ![allanpog](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@allanpog](https://forum.arduino.cc/u/allanpog)\
**Post date:** [July 26, 2022, 10:33am UTC](https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767/26 "2022-07-26T10:33:15Z")

</div>

Yeah I agree, plus the tips and traps. I think there’s some hard won experience in there.

Cheers, Allan

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [January 22, 2023, 10:33am UTC](https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767/27 "2023-01-22T10:33:24Z")

</div>

Closed on January 22, 2023, 10:33am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

[Previous page](https://forum.arduino.cc/t/global-declared-variable-reverting-to-declared-value-in-loop/1015767.md?page=1)
