Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
number = %NUMARGS
The number of formal arguments that have associated activation arguments. See How arguments and parameters are handled for a description of the different types of arguments. (i)
%NUMARGS returns the number of arguments passed to the current subroutine or function.
For a non‑^VAL function, %NUMARGS returns a value that is one greater than the number of arguments passed, because it includes the function’s return value in its count. We recommend that all functions that return an integer value be defined as ^VAL.
In Synergy .NET, %NUMARGS returns the number of the last passed argument, which can be different than the return value for traditional Synergy when there are optional arguments. For example, if a subroutine called mysub has three optional arguments, %NUMARGS will return 2 for both traditional Synergy and Synergy .NET for the first example below:
xcall mysub(arg1, arg2)
But for the following example, it will return 3 for traditional Synergy and 2 for Synergy .NET:
xcall mysub(arg1, arg2, )
And for the following, if mysub has one optional argument, %NUMARGS will return 1 for traditional Synergy but 0 for Synergy .NET:
If you call the subroutine below using the following line:
xcall sub("one", "two")
%NUMARGS returns a value of two.
subroutine sub arg1 ,a arg2 ,a arg3 ,a record i ,d2 proc for i from 1 thru %numargs process arguments