-
With the test script into which you want to insert a new function open, select from the Silk Performer menu bar. You can also access this dialog by right-clicking within the body of the script and selecting New Function from the context menu.
The New Function dialog appears.
-
In the Name field, enter a name for the function you want to insert into your test script. The name must begin with a character and may
consist of any number of letters of the alphabet, digits, and underscores.
-
From the Return type list box, select the data type of the function's return value. Choose one of the following:
-
none - for the function to return nothing
-
boolean - for the function to return either true or false
-
float - for the function to return any positive or negative floating-point value or zero
-
number - for the function to return any positive or negative whole number or zero
-
string - for the function to return a sequence of characters
-
In the Parameters list, insert the parameters that you want to pass to the function. For each parameter, enter a name in the Name column and select the data type from the Type list box:
-
boolean - for the parameter to contain either true or false
-
float - for the parameter to contain any positive or negative floating-point value or zero
-
number - for the parameter to contain any positive or negative whole number or zero
-
string - for the parameter to contain a sequence of characters
-
Use the Preview area to see how the function declaration looks when it is inserted into your script. The declaration contains the parameters
you insert into the list as well as the return type. Keep in mind that it is up to you to add the function code after the
function declaration has been inserted into the script.
-
Click OK.
The new function is placed in your script, and appears in the script editor window.