A branch allows the presence or absence of list items based on the conditions represented by a variable value. A small branch may involve only a few items, but it can also be considered a “fork in the road” when there are multiple items (and possibly other branches) within the branch. Branches can be created using 2 of the 4 types of variables: question
or select
.
Intended for use with a variable that has already been defined in a question
prompt (or optionally in a variable assignment). As with normal line indentation, indents must be 2 spaces within brackets. This 2 space indent will not be included in the final output; everything within the bracket will have an indent flush with that of the branch &
header line. Example:
#Airline boarding pass
& (question) haveAirlineApp
{
Sign in to airline phone app
Bring up boarding pass for scanning
} else {
Bring printed boarding pass
}
The first bracketed case is used if the variable has a True value, otherwise they will be ignored and the line after } else {
will be used.
An else (False) case is not required, if only True case items apply to the situation:
#Driving to event
& (question) cashOnlyVendor
{
Stop by ATM to get cash
}
Pick up friends on the way
A true case is not required, either. In this example, a Passport will not be included if airlineDomestic
is True:
Wallet
Credit cards
Cash
Driver's license
& (question) airlineDomestic
{
} else {
Passport
}
Intended for use with a variable that has already been defined in a select
prompt (or variable assignment). Here is an example of a select
branch that references the select prompt example in the Prompts page:
& (question) isRaining
{
& (select) rainProtection
{
^
} {
Put on poncho
} {
Put on rain jacket
} {
Put on rain boots
Put on rain gear pants
Put on rain jacket
} {
}
}
In this case, there are multiple cases each contained within their own starting and ending brackets. Individual cases are divided by a } {
line (must both be on the same line). The order of the brackets corresponds to the order in the prompt for that variable. Within each curly bracketed section, it is possible to include as many normal or markup tag lines as desired; but it is best to stick to a few lines for readability. If many lines are desired in a particular case, then the better option is to link to another list that contains those lines.
If option 1 is selected above, then the output will be “Umbrella”, because the ^
symbol represents using the prompt text from the select prompt example in the Prompt page for that case in the final output. If option 5 is selected, then no output is generated due to the empty bracketed case (to match the prompt's “None” option).
If the select
variable was defined with a prompt, then the corresponding branch must contain the same number of conditions. However, if the variable is a number (i.e. from a number
prompt or an assignment), then the select branch can have any number of cases. In this mode, the parser will select the case that is closest to that number value.
As with list links, it is possible to place a conditional branch inside of another branch, which is itself inside of another branch… etc. This nesting is allowed until a level of 50 branches deep is reached, at which point an error message will be shown preventing the generation of the output checklist. Otherwise, there is no limit on the total number of branches.
A branch references a variable in order to get its value to decide which path to take. This reference exposes the list to a possible variable ordering error, which is discussed in the Variable Ordering section of the syntax page.