# Macro. Strange returned values in the loop

**URL:** <https://klipper.discourse.group/t/macro-strange-returned-values-in-the-loop/11804>\
**Category:** General Discussion\
**Created:** [November 23, 2023, 12:36pm UTC](https://klipper.discourse.group/t/macro-strange-returned-values-in-the-loop/11804 "2023-11-23T12:36:17Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [November 23, 2023, 1:03pm UTC](https://klipper.discourse.group/t/macro-strange-returned-values-in-the-loop/11804/2 "2023-11-23T13:03:45Z")

</div>

See

> [@Help with Macro: SET\_GCODE\_VARIABLE doesnt set my variable](https://klipper.discourse.group/t/help-with-macro-set-gcode-variable-doesnt-set-my-variable/11014/10):
>
> That’s because macros are evaluated before they are run. All the variables are “translated” before the macro is executed so if the macro itself changes the value of a variable, that change won’t be reflected during the same execution of the macro. To work around this, create a second macro called something like TEST\_RESPOND, have that macro do the RESPOND TYPE=error MSG=‘{test}’ line, and call TEST\_RESPOND at the end of TEST. Keep in mind that TEST\_RESPOND will need to lookup the value of the te…

and following posts for an explanation.

---

_[View the full topic](https://klipper.discourse.group/t/macro-strange-returned-values-in-the-loop/11804)._
