Description:
Syntax:
ch.iterate(x,a,c)
Note:
The function loops through record sequences in channel ch to calculate expression x and returns the result of the last calculation of x. ~~ represents the previous value of x. Parameter a is the default initial value for each calculation, whose absence indicates a null initial value. Exit the loop once the result of expression c is true.
Parameter:
ch |
A channel |
x |
An expression |
a |
Initial value |
c |
An expression returns true/false |
Return value:
Result of expression x
Example:
|
A |
|
1 |
=[2,222,22,122,2222].cursor() |
|
2 |
=channel() |
|
3 |
=channel() |
|
4 |
=A2.iterate(~*2) |
|
5 |
=A3.iterate(~~*2,3) |
|
6 |
=A1.push(A2,A3) |
|
7 |
=A1.fetch() |
|
8 |
=A2.result() |
4444 |
9 |
=A3.result() |
96 |
10 |
=[100,200,800,2000].cursor() |
|
11 |
=channel() |
|
12 |
=A11.iterate(~~*3,10,~>250) |
|
13 |
=A10.push(A11) |
|
14 |
=A10.fetch() |
|
15 |
=A11.result() |
90 |