func()

Read(211) Label: func,

Here’s how to use func() function.

func()

Description:

Call a subroutine.

Syntax:

func(c,xi)

Note:

A subroutine can be called in any cell as required once defined in a program cellset. The function calls a subroutine starting from master cell c and, in the meantime, passes in parameter xi and makes it the value of c. Return the return value defined by the subroutine after the call is completed.

Parameters:

c

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

xi

The parameter used in a subroutine; can be a numerical value, a sequence, or other types of value

Return value:

The return value of the subroutine.

Example:

 

A

B

 

1

func

 

Define a subroutine

Return the sum of the members of the passed parameter – whose value is a sequence

2

 

return A1.sum()

3

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

 

Calling method; the return value is 6

 

func …{return x i }

Description:

Define a function block.

Syntax:

func

{return xi}

Note:

The function defines a function block, which may or may not return a result after computation. The function block (subroutine) begins with the starting characters func and covers a cell range where the master cell is the one holding the func. The return statement is used to return the function’s result and terminate the execution of the function block. The subroutine will by default return the value of the last calculation cell if no return statement appears during execution.

Return value:

The result of the function block.

Example:

 

A

B

 

1

func

 

Define a subroutine where the parameter passed in is a sequence and that returns the sum of members of the sequence

2

 

return A1.sum()

Related functions:

 func()