RX0042

Domain: Execution

Error message

the condition at %s is not a truth value (it is %s)

In the message, %s marks a value that the engine fills in when it raises the error.

The story

You wrote an if, and the question inside it was not really a question. The engine said: that is not a truth value. In many languages, zero means false and any other number means true, or a nonempty word means true. Rush refuses to guess. By default, a truth value is the word true or the word false, and a number is never presumed to mean either. Why? Because guessing is dangerous. If zero reads as false, fine, but if the word false reads as true, because it is not empty, that is just as defensible, and just as arbitrary. A branch that guessed would silently run the wrong body, and you would be reading the output of a different program. The message tells you where the condition is and what type actually arrived, so you can see what you handed it. For example, if you wrote if with a bare count, the engine will say it received a number. The fix: write a real comparison, like the count is greater than zero, or call something that produces a truth value. Ask a clear question, get a clear answer.

Text from the Rush engine's error catalogue.