Skip to content
Discussion options

You must be logged in to vote

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.

---
title: "Quarto Playground"
format: html
---

```{r}
#| echo: false
cur = 24
```

```{r}
#| echo: false
#| ref-label: ex1
```

We consider this in Example `{r} ex1_label` below.

... some text ... 

```{r}
#| label: ex1
#| echo: false
cur = cur + 1
ex1_label = cur
```

The value of `cur` now is `{r} cur`

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mcanouil
Comment options

Answer selected by finkelshtein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants