func()

Read(1139) Label: call, subroutine,

Description:

Call a subroutine.

Syntax:

func(c,xi)

Note:

You can call a subroutine from any cell as required once defining it in a program cellset. The function calls a subroutine starting from master cell c and, in the meantime, passes in parameter xi, if the parameter exists, and assigns it to c. If there are multiple parameters xi, like x1 , x2 , x3,... xi,  they will be assigned to cells in a row from left to right starting from cell c. Return the return value defined by the subroutine after the call is completed.

Parameter:

c

The master cell of a subroutine; it is usually the cell where the func is located

xi

The parameter used in a subroutine, which can be a numerical value, a sequence, or other types of value; use comma to separate them if there are multiple parameters

Option:

@i

Increase performance by not using recursive invocation; by default, the function will copy cells to enable recursive invocation

@m

Enable macro invocation when the func function body only consists of an expression, whose variables must not be changed

Return value:

The return value of the subroutine

Example:

 

A

B

 

1

func

 

Define a subroutine.

Return sum of members of the passed-in sequence parameter.

2

 

return A1.sum()

3

=func(A1,[1,2,3])

 

Calling method; the return value is 6.

 

 

A

B

 

1

func

 

Enter parameters in continuous cells from left to right, that is, 8 for A1 and 3 for B1.

Return product of the two parameters.

2

 

return A1*B1

3

=func(A1,8,3)

 

Call A1’s subroutine and return 24.