| || |
- One without arguments
- One accepting arguments
If not, is there any other possibility in order to achieve this ?
Scripting languages don't support this, however, in JScript, you can pass any number of parameters to a function. For example:
<font class="small">Code:</font><hr /><pre>function variableParameterNumber()
// This code is executed if there are no parameters
Log.Message("There are no parameters");
// This code is executed if there are parameters
Log.Message("Parameter value is: " + arguments);
variableParameterNumber(); // Output: "There are no parameters"
variableParameterNumber("A string"); // Output: "Parameter value is: A string"
Thanks for this example.