---
id: change/bcquality/136
type: change
title: "#136 Add community knowledge: AL boolean operators do not short-circuit"
summary: Two community knowledge articles explain AL's lack of short-circuit evaluation for boolean operators and recommend using case statements as alternatives for complex condition chains.
tier: official
language: en
tags:
  - feature
  - main
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:06:37.215Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: c39f723caedbdf622c9da6cdcb664b28f3ee2f10
evidence:
  - kind: code
    url: https://github.com/microsoft/BCQuality/pull/136
    title: "microsoft/BCQuality#136: Add community knowledge: AL boolean operators do not short-circuit"
    date: "2026-09-02"
    commit: c39f723caedbdf622c9da6cdcb664b28f3ee2f10
    t: null
    quote: AL gives no short-circuit (lazy) evaluation guarantee for `and`, `or`, or `xor`.
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 136
repo: microsoft/BCQuality
source_id: bcquality-prs
url: https://github.com/microsoft/BCQuality/pull/136
kind: pr
base_branch: main
major: null
merged_at: "2026-09-02T12:48:33Z"
author: aacnsilva
author_type: User
community_contribution: false
labels: []
change_class: code
change_kind: feature
behavior_change: false
breaking: false
files:
  count: 6
  additions: 215
  deletions: 0
  al: 6
apps: []
objects_touched: []
objects_unjoined:
  - path: community/knowledge/performance/boolean-operators-do-not-short-circuit.bad.al
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/performance/boolean-operators-do-not-short-circuit.good.al
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/performance/boolean-operators-do-not-short-circuit.md
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/performance/case-true-of-for-long-condition-chains.bad.al
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/performance/case-true-of-for-long-condition-chains.good.al
    status: added
    reason: not-in-snapshot
  - path: community/knowledge/performance/case-true-of-for-long-condition-chains.md
    status: added
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items: []
systems:
  - development
  - platform
quote: AL gives no short-circuit (lazy) evaluation guarantee for `and`, `or`, or `xor`.
joined_against:
  major: null
  commit: null
---

# #136 Add community knowledge: AL boolean operators do not short-circuit

> Two community knowledge articles explain AL's lack of short-circuit evaluation for boolean operators and recommend using case statements as alternatives for complex condition chains.

[Pull request](https://github.com/microsoft/BCQuality/pull/136) · merged into `main` on 2026-09-02 by aacnsilva · 6 files (+215 -0), 6 AL · feature · tier official · reviewed (checked by Opus)

## What changed

- AL gives no short-circuit guarantee for and, or or xor, so guards should not rely on operand order
- Shows silent bugs such as reading a field from a record Get did not load, or evaluating an out-of-range subscript
- For or, use an early exit (if A then exit(true); exit(B);) rather than the nested if rewrite used for and
- Recommends case true/false of as a flat alternative once a guard chain goes past about three nested ifs
- Includes good and bad AL samples for both articles

## AL objects touched

- `community/knowledge/performance/boolean-operators-do-not-short-circuit.bad.al`: added, not in the BC? snapshot yet
- `community/knowledge/performance/boolean-operators-do-not-short-circuit.good.al`: added, not in the BC? snapshot yet
- `community/knowledge/performance/boolean-operators-do-not-short-circuit.md`: added, not in the BC? snapshot yet
- `community/knowledge/performance/case-true-of-for-long-condition-chains.bad.al`: added, not in the BC? snapshot yet
- `community/knowledge/performance/case-true-of-for-long-condition-chains.good.al`: added, not in the BC? snapshot yet
- `community/knowledge/performance/case-true-of-for-long-condition-chains.md`: added, not in the BC? snapshot yet

## Context

- Systems: development, platform
- From the description: "AL gives no short-circuit (lazy) evaluation guarantee for `and`, `or`, or `xor`."

Source: metadata of a merged pull request in microsoft/BCQuality (bcquality): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
