| Applying science to business management |
  
branch
Format: branch( choice, branch1,
branch2, ... )
Arguments: (text,logic) choice Usually a call to
choose or askyesno
[any] branchN Any nodes
Returns: [any] Value of the selected branch
Description: This function is used to create an
interactive decision tree node.
Branch first generates a list containing the comment
text attached to each child of the active node and then assigns
this list to the branchoptions
primitive. Next, branch executes choice. Usually, choice
contains a call to an input functions such as choose which uses branchoptions to construct its
query. The result of this input function is then compared to the
comment text list to find out which child node contains the
selected text. Finally, the node whose comment matches the
selected text is evaluated.
For example, in the following tree branch first sets branchoptions equal to the value ["Option 1","Option 2"].
Next, the call to choose
will display a query similar to the following:
Finally, if the user chooses Option 1 then Branch 1
is executed. Similarly, if the user chooses Option 2 then Branch
2 is executed.
If choice is a Boolean value from askyesno, branch1 is
evaluated if true and branch2 if false.
See Also: branchoptions,
choose, askyesno
|