#Early return in gcode_macro?

7 messages · Page 1 of 1 (latest)

bleak forge
#
{% if <some sanity check> %}
  # print some warning
{% else %}
  # do the thing
{% endif %}

Is there an alternative to this which avoids unnecessary nesting? Or is my only option to use a pattern such as defining MY_MACRO (the one with sanity checks) and MY_MACRO_IMPL (actual logic).

EDIT: In other words, is this possible and how so (the # end macro pseudocode)

{% if <some sanity check %> }
  # print some warning    
  # end macro
{% endif %}
# do the thing
deep thicket
#

i guess it depends on how much you plan to do in each if statement

#

thats not bad tho, if else

bleak forge
#

Not sure if I understand - I'm asking if there is a way to do something like this:

{% if <some sanity check %> }
  # print some warning    
  # end macro
{% endif %}
# do the thing

I don't think this is possible (the # end macro part) - just want to confirm if that's the case

deep thicket
#

like a return call?

#

id just do the else. ive not seen something like a return call

#

#klipper_kalico_discussion message

as i suspected