<<*If*>> Prompt
Typically, "If . . . Then" logic is not provided by Pathagoras. It is simply too much like programming, which we stay away from as much as possible.
Nevertheless, Pathagoras allows you to add a bit of 'logic' to your program among the other <<*Ask*>> prompts. We call it the <<*If*>> prompt.
Let's say you are drafting a document that has optional text dealing with children. You want the text to be kept in the document when there are children and discarded when there are none. Let's further say that the document contains other language that you want to keep when there are minor children, but which should be discarded where there are none.
Using AskOptional prompts alone, you could first ask the question "Are there children?". If (but only if) that question is answered "Yes", you would ask "Are there minor children?". Here is the way this sequence might appear at the top of your document:
<<*AskOptional*!Children!Are there children?*>>
<<*If*!Children!="Yes",<<*AskOptional*!Minors!Are there minor children*>>,!minors!="No">>
Let's study the structure.
1. Note first that a !groupname! (in this case children) is used. As with other !group!, the name ties the various prompts together.
2. Secondly, note the classic three-part "if . . . then" programming structure:
"(True or False condition),(If True Action),(If False Action)"
This three-part structure is practically universal. Simple commas are used to separate the three elements.
As applied to the example, the user first encounters the initial (Children) question. The user provides either a "Yes" or "No" answer. The "If" prompt is encountered immediately after. Pathagoras 'measures' the value of the !Children! group, and responds accordingly. If !Children! was answered "Yes", Pathagoras presents the prompt that follows the first comma. If Pathagoras sees that !Children! was not answered "Yes", it processes the information that follows the second comma. portion is triggered by the
The sequence of the Ask prompts is, of course, critical. So is the proper spelling of the groupnames. However, "True" and "Yes" are totally interchangeable, as are "False" and "No".
See Big Example for more examples of the <<*If*>> prompt.