Variable in function that keeps its value between each iteration

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;

The documentation covers this here: