why -1 evaluates true
Posted on August 1st, 2008 by Yousef Ourabi
Languages that do not have native boolean data-types that let you branch on non-boolean data types evaluate all non zero values as “truthy”, (-1) evaluates to true. You might be wondering, as I did, why that is? The short version: it is a compiler optimization.
At first I thought it was a perl specific choice, [...]
Filed under: Programming |




