Pass variables to timer.setTimeout

Hello,
Is there a way to pass variables to timer.setTimeout ?
I have 8 valves and like to turn off specific valves without creating a lot of if statements etc.

It should like the following:
timer.setTimeout (interval, TurnOffValves(int valve, int state));

but when compiling this part i’ve got the follow error:

invalid use of void expression.
if you need the whole code please let me know

timer.setTimeout (interval, TurnOffValves) is the right use. If you need to pass a variable I believe the better approach would be to assign a global variable as its value changes

Ok thank, btw thats a better idea