Additional Information - A function is executed only once and closed after it is called out. - A simple expression is remade into a function in the sample above. Separating operation part (Function) and external variables exchanging part (Subroutine) in complex and repeating operation is useful to reduce program lines and to simplify the processing in a program. 34 6. Open Code Editor of the current screen or Global Subroutine Group and enter the code in the right illustration. [Description] Declare Local Data, an array _ variable, in the subroutine Data Calc. Substitute different _ values into each variable. The following process is executed repeatedly:
Execute the function Add Data for the global variable _ Disp Val. Then substitute the _ returned value. Array variable Data Calc is given _ to Add Data as an argument. _ In function Add Data, 1000 is _ added to the passed value, and it is substituted as a return value. screen or Global Subroutine Group and enter the code in the right illustration. [Description] Declare Local Data, an array _ variable, in the subroutine Data Calc. Substitute different _ values into each variable. The following process is executed repeatedly: Execute the function Add Data for the global variable _ Disp Val. Then substitute the _ returned value. Array variable Data Calc is given _ to Add Data as an argument.
_ In function Add Data, 1000 is _ added to the passed value, and it is substituted as a return value. 7. Startup Simulator to confirm the subroutine’s operation. Click the button on the screen. Check if the data display components show the result of subroutine.