SoFunction
Updated on 2025-04-14

WMLScript Script Programming Page 8/9


Library functions
Specifically specified that WML Script library functions refer to its standard library functions. Because it corresponds to standard library functions, WML Script also has some non-standard library functions. Let’s introduce standard library functions here first, and non-standard library functions will be introduced later.
All library functions have a number of libraries, and the library of functions usually contains a type of functions. Therefore, when calling a library function, one must specify its library name and the other must specify its function name. WML Script stipulates that when calling standard library functions, it can be achieved by adding a period number (.) and standard calls to the library function after the name of the function library. The syntax format is:
Function library name. Function name (parameter list);
For example, the Float library of WML Script has a root function sqrt in the Float library. The function has only one parameter. Then the method to call the squrt library function is:
(number);//This requires that number be greater than or equal to 0
Below is a simple example of calling library functions. First, call the() function with a param parameter value, add 1 to the return result and then call the() function as a parameter. Its return result is used as the return value of the internal function test:
function test(param){
return ((param)+1);
};
2.3 Nested calls of functions
The function definitions of WML Script are parallel and independent of each other. When defining functions, we cannot define another function within one function, that is, the function definition cannot be nested. However, function calls can indeed be nested, that is, we can call another function during the process of calling one function.
Its execution process is:
(1) Execute the beginning part of function a;
(2) When encountering an operation statement that calls function b, the process will execute function b in the special area;
(3) Execute the beginning part of function b;
(4) When encountering an operation statement that calls the c function, the process will execute the c function in the special area;
(5) Execute function b. If there are no other nested functions, complete all operations of function c;
(6) Return the statement calling function c, that is, return to function b;
(7) Continue to execute operations that have not been executed in function b until function b ends;
(8) Return the statement in function a to call function b;
(9) Continue to execute the remaining operations of function a until the end of the function.
function myFunC(param1){
return param1*param1=((param)+1);
};
function myFunB(param0){
return myFunC(param0+1)*|param0+12;
};
function myFunA(param){
return myFunB(param*param+1);
};
Previous page123456789Next pageRead the full text