Passing a variable to a snippet

I have defined a variable in a webpage and set a value to 0.

I have a snippet further down the page which is included conditionally depending on a form answer from the user.
If included, I need this snippet to increment the variable, but I get a Kirby error message stating the variable hasn’t been defined.
Is there a way around this?

You can pass the value into the snippet.

Brilliant, I missed that, thank you.