Tuto WINDEV Mobile 25
Part 4: Programming concepts 93 Remark In the same procedure, some parameters can be passed by reference while other parameters can be passed by value. All you have to do is used the LOCAL keyword in front of each parameter passed by value. Mandatory or optional parameters? The parameters received in the procedure can be mandatory or optional parameters. A mandatory parameter must be filled during the call to the procedure while an optional parameter can be omitted: in this case, it will take the default value defined when declaring the procedure parameters. Remark When declaring a procedure, the optional parameters are the last parameters (they are always specified after all mandatory parameters). In the following example, the Multiplication procedure is using an optional parameter, Nb2. This optional parameter is indicated after the mandatory parameters, by specifying its default value. In this example, the default value of optional parameter is set to 10. PROCEDURE Multiplication(Nb1 is int, Nb2 is int=10) MyResult is int MyResult = Nb1 * Nb2 RESULT MyResult The code used to call the procedure is as follows: res is int res = Multiplication(6) // Res is equal to 60 In this example, the second parameter was not specified. Therefore, its default value will be used. Procedure result The procedures can return one or more results. The result can be typecasted. The RESULT keyword must be used to return a value. See the online help for more details (keyword: Result).
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==