How to use a variable before it was declared in the code without executing that code at that time #10859
-
DescriptionHi, I am working on a temporal solution for the problem described in Discussion #10844, using some find/replace and R code chunks. Most of the things are working, however, I have cases where I need to make a "reference" (not a Quarto reference, a self-made one) to a theorem-like environment which is somewhere below. I tried to use
If you run this code, the value of My understanding is that the code |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
To be clear: the current output of the code above is |
Beta Was this translation helpful? Give feedback.
That's not how it works.
All code are executed sequentially as it would in regular script.
If you change the variable, then you overwrite the previous value, that standard programming behaviour and is unrelated to Quarto.
You need to change your programming logic here.
Also, do not mix syntaxes for options.
Stick to one. In Quarto, the recommended syntax is YAML.