bcquality/community/knowledge
António Silva 63bd69d7e5 Add case true of pattern for long condition chains
Follow-up from PR review: nested if is the right answer for two or three
dependent conditions, but past that the nesting becomes the problem. AL's
case statement is the flat alternative — the control statements
documentation states a value set "must be an expression or a range" and
that the first matching value set executes, so case true of / case false of
accept boolean expressions and stop at the first match. That is the
laziness the boolean operators do not provide.

Adds case-true-of-for-long-condition-chains.md with good/bad AL companions:
case false of for guard chains where every condition must hold, case true of
for first-match dispatch. The bad sample shows both failure shapes — a
five-level if ladder, and the worse escape of collapsing it into an and
chain, which trades nesting for a real defect.

Cross-links both articles, and adds the threshold to the short-circuit
article's Best Practice so following it does not lead to a deep ladder.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 12:00:14 +01:00
..
data-modeling Add TransferFields SkipFieldsNotMatchingType guidance (#133) 2026-08-24 09:54:37 +02:00
performance Add case true of pattern for long condition chains 2026-08-25 12:00:14 +01:00
security Promote validated community knowledge (#105) 2026-07-14 14:20:27 +02:00
ui Promote validated community knowledge (#105) 2026-07-14 14:20:27 +02:00
.gitkeep Add .gitkeep files to community and microsoft directories; remove .gitkeep from samples 2026-04-17 06:03:14 +02:00