Dollar-sign expansion using parameters

Parameters can be used in dollar-sign expansions. The variable must then contain formal parameters, such as $1, $2, $3 etc. When expanding the variable, the parameters should be stated in a comma separated list.


Set MUL=’$1*$2’;

Set X=$(MUL(3,7)); // returns '3*7' in X

Let X=$(MUL(3,7)); // returns 21 in X

If the number of formal parameters exceeds the number of actual parameters only the formal parameters corresponding to actual parameters will be expanded. If the number of actual parameters exceeds the number of formal parameters the superfluous actual parameters will be ignored.


Set MUL=’$1*$2’;

Set X=$(MUL); // returns '$1*$2' in X

Set X=$(MUL(10)); // returns '10*$2' in X

Let X=$(MUL(5,7,8)); // returns 35 in X

The parameter $0 returns the number of parameters actually passed by a call.


set MUL='$1*$2 $0 par'; 

set X=$(MUL(3,7)); // returns '3*7 2 par' in X

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?