Limiting the Number of Incorrect Responses to a Question

If you’re running a quiz or survey, you may want to cap how many times a contact can answer a given question. You can enforce this by using the @node.visit_count expression inside a Split by Expression node.
In the example below, we built a very simple quiz and want to restrict the number of guesses. We place @node.visit_count on a Split by Expression node to control how many attempts are allowed.
Here’s the pattern: after a Wait for Response collects the contact’s answer, a Split by Expression evaluates it. Because we only want to offer two chances to get it right, we add a rule where @node.visit_count has a number above 1—meaning that after the second visit to this question node, the flow disallows any further tries.
Practically, this means: if the contact answers correctly on the first attempt, they go through the Correct exit of the Wait for Response node and receive a congrats message. If the first attempt is wrong, they’re routed to the Other exit, where we apply the limit. Since our rule checks for a count above 1, a second incorrect answer exhausts their attempts and the flow stops offering more tries.
You can observe this behavior in the Simulator. In one run, a contact answers incorrectly the first time, gets a second—and final—chance, and then fails again. Because we set @node.visit_count to block values above 1 via a Split by Expression, that second miss uses up all available attempts.
Another contact, however, studies a bit more and succeeds:
Notice that our follow-up message references how many attempts the contact has made. We do this by inserting @node.visit_count/2 in the text. This is especially helpful if you offer more than two tries, so contacts can see how many opportunities remain.
Remember, visit_count applies only to the current flow run. If a contact is started in the flow again, the counter resets to zero—previous runs do not carry over.