Contrary to EachTime and Finally, Initdo must be added in the editor by the user. To do so, Cmd click, type its name and validate, as for any other box.
Note that there can be only one Initdo box in the editor : the box can be added multiple optional inputs.
Press Alt + → or ← to add or delete an input.
Example : Modifying a List Before an Enumeration
We'll send a message and reverse our list before the iteration begins.
On the left, Initdo is called internally before the iteration starts. It performs three evaluations :
Input #1 evaluates a
print
box, which prints the original list
Input #2 evaluates another
print
box, which prints the following message : "let's revers the list".
Input #3 evaluates the
reverse
function, which reverses the original list.
Then, the iteration starts : Listloop enumerates the items of the reversed list returned by
reverse
. EachTime and Finally return the results of the iteration.
At each step, EachTime evaluates a
print
box that prints a an item of the list
At the end of the iteration, Finally returns the resulting list.