Please use the Insert Code Snippet button in the above toolbar when adding a code example.
1. You can use a (if:) macro combined with one or more (else-if:) macros to check if one of a series of conditions are true.
(if: $score >= 15)[Score is in the High band]
(else-if: $score >= 10)[Score is in the medium band]
(else-if: $score >= 5)[Score is in the low band]
(else-if: $score < 5)[Score is too low to rate]
2. You can use the and & or operators to join multiple conditions together to form a larger one.
The following example uses the and operator to produce the same outcome as the point 1 exampe
(if: $score >= 15)[Score is in the High band]
(else-if: $score < 15 and $score >= 10)[Score is in the medium band]
(else-if: $score < 10 and $score >= 5)[Score is in the low band]
(else-if: $score < 5)[Score is too low to rate]
3. When using a (if:) + (else-if:) structure like those in points 1 & 2 you can often replace the last / final (else-if:) macro with an (else:) macro.
Doing this can be a good ideal because that (else:) will also handle any conditions your logic has missed.
The following example uses the (else:) macro to produce the same outcome as the point 1 & 2 exampes
(if: $score >= 15)[Score is in the High band]
(else-if: $score >= 10)[Score is in the medium band]
(else-if: $score >= 5)[Score is in the low band]
(else:)[Score is too low to rate]
The following is a modified version of your example, it handles the extra $pa related ranges as well as the situation where $pa is outside the stated range.
(if: $point1 !== "" and $point2 !== "" and $point3 !== "" and $point4 !== "")[
(if: $pa >= 20)[
(replace: ?result)[Score is outside allowed range, please report this error.]
]
(else-if: $pa >= 15)[
(replace: ?result)[Your english is very advanced! Excellent]
]
(else-if: $pa >= 5)[
(replace: ?result)[Good, but work harder]
]
(else:)[
(replace: ?result)[your level is bad]
]
]