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)?
https://repl.it/@programmeruser/Pass-by-reference
Edit 3/16/2022 8:04 PM EST: TheProgrammer3 -> programmeruser, fixed link (it was rendering as an empty embed for some reason)