Just to be clear; the argument of any function is a computation that produces the result you want for that parameter. The simplest computation is a constant, e.g., 1. But anything that produces a suitable value may be used. Since digitalWrite wants an 8-bit unsigned pin number, any computation you can imagine that produces an 8-bit value in the range of pin numbers is valid.
digitalWrite(SomePin - 1, (on ? HIGH : LOW) );
(yes, you might question why you know that SomePin, which might be a variable, requires subtracting 1 to get the correct pin number. This would actually be a pretty poor programming style. I use it to illustrate that any expression can be used, as long as it makes sense in your circuit).
joe