# if(... EQUAL 0) syntax

**URL:** https://discourse.cmake.org/t/if-equal-0-syntax/3886
**Category:** Code
**Created:** [August 6, 2021, 8:30am UTC](https://discourse.cmake.org/t/if-equal-0-syntax/3886 "2021-08-06T08:30:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [August 6, 2021, 8:30am UTC](https://discourse.cmake.org/t/if-equal-0-syntax/3886/1 "2021-08-06T08:30:23Z")

</div>

I believed correct syntax for the if(EQUAL) would be like

```auto
try_run(runcode buildOK ...)

if(runcode EQUAL 0)

endif()

```

That usually works, but I ran into a CentOS 8 system where even though `message(STATUS ${runcode})` showed 0, the `if(runcode EQUAL 0)` clause failed to be true. The system locale is English US. The statement does work on other systems.  
On the problem system, the try\_run() code does run correctly and gives expected RUN\_OUTPUT\_VARIABLE value as per my code (say hello.c).

To work around this I just simply ignored the runcode, and put a unique string into the run output variable so that I knew the program ran correctly.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [August 6, 2021, 10:09pm UTC](https://discourse.cmake.org/t/if-equal-0-syntax/3886/2 "2021-08-06T22:09:39Z")

</div>

Bit of a long shot, but has something erroneously defined a variable named “0”? It’s a crazy quirk, but it actually is possible to define a variable whose name consists only of digits (but please never do this deliberately!). I seem to recall a user hitting something like this a while back where an error in their logic was resulting in creating variables named “1”, “2”, etc.
