Variable in function that keeps its value between each iteration

#1

Hi, it’s me again !

I’ve seen somewhere how to do to keep the value of a variable between each pass of the function (like a counter for instance).
I think it has to do with “global” or “context” or maybe both. But impossible to find this information back !
I think it was something like:

global.context myvar = 0;
myvar += 1;
#2

The documentation covers this here: https://nodered.org/docs/writing-functions#storing-data