# Precedence in compound conditions

**URL:** <https://discourse.cmake.org/t/precedence-in-compound-conditions/4979>\
**Category:** Code\
**Created:** [February 8, 2022, 3:59pm UTC](https://discourse.cmake.org/t/precedence-in-compound-conditions/4979 "2022-02-08T15:59:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmilea](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/v/f14d63/32.png) [@vmilea](https://discourse.cmake.org/u/vmilea)\
**Post date:** [February 8, 2022, 3:59pm UTC](https://discourse.cmake.org/t/precedence-in-compound-conditions/4979/1 "2022-02-08T15:59:47Z")

</div>

The documentation states:

> Compound conditions are evaluated in the following order of precedence: […] Then the boolean operators in the order NOT, AND, and finally OR.

But the following prints “FALSE”:

```auto
cmake_minimum_required(VERSION 3.22)

project(Test)

if(YES OR NO AND NO)
    message("TRUE")
else()
    message("FALSE")
endif()

```

So the expression isn’t being evaluated as `YES OR (NO AND NO)`. Could someone explain this surprising behavior?

---

<div class="post-metadata">

**Author:** ![vmilea](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/v/f14d63/32.png) [@vmilea](https://discourse.cmake.org/u/vmilea)\
**Post date:** [February 9, 2022, 6:44pm UTC](https://discourse.cmake.org/t/precedence-in-compound-conditions/4979/2 "2022-02-09T18:44:45Z")

</div>

Must be a bug, so I’ve opened an [issue](https://gitlab.kitware.com/cmake/cmake/-/issues/23207).
