Is it possible to pass by reference in Snap?

In C++, you can do something like this:

#include <iostream>
using namespace std;
void inc(int*var) {
  ++(*var);
}
int main() {
  int x = 10;
  cout << x <<"\n";
  inc(&x);
  cout << x << "\n";
  return 0;
}

which basically passes a pointer/memory address to the function which increments the variable.

Is there a way to do something like this in Snap (passing a reference to a variable)?

yes
screenshot

untitled script pic (5)

1 Like

Thank's, you save my life ! (almost)