V also supports closures. This means that anonymous functions can inherit variables from the scope they were created in.
However, unlike a lot of languages, captured variables must be explicitly listed after the
keyword inside square brackets:
Captured variables are copied when the anonymous function is created. This means that if the original variable is modified after the creation of the function, the modification won't be reflected in the function.
However, the variable can be modified inside the anonymous function. The change won't be reflected outside, but will be in the later function calls.
If you need the value to be modified outside the function, use a reference.