Cannot set Variabel in loop with Scratch


I would like to set a specific variable durring a loop (range), with Scratch. But somehow if i want to print the value, nothing happend. Why is that?

Example Code:

    {{ range $ }}
        {{ .Scratch.Set "foo" "bar"}}
    {{ .Scratch.Get "foo"}}

Try $.Scratch.Set …

Thanks. That worked.

Different Question: Is it possible to set varliables on events? Like on “onclick”? (Should i open a new Support Request?)

Yes, you should.

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