#1
|
|||
|
|||
subroutine parameters
Got a question about optional parameters to subroutines. For a few of my commonly-used subs, I'd like to have some optional parameters to make them a little extensible.
For boolean parameters to say "don't do that" or "do this", probably using a script build condition that checks for the existence of the macro as well as its value can solve that problem. (Though now that I think about it, this kind of behavior is bad programming practice... oops.) However, for other parameters such as strings to put in the log, things seem a bit more tricky. The best I can come up with is setting the parameter to some default value if the parameter is not defined as the first step of the subroutine. The issue with this is then "popping" that value at the end by deleting the macro. Is there an example or recommended way of doing this? Or am I trying to do too much? Sorry if this was unclear, and let me know if I can explain anything better. Thanks in advance. |
Thread Tools | |
Display Modes | Rate This Thread |
|
|