News for hackers. Stuff that matters.
Re:Literals in Programming Languages by tantalor on Thursday February 28, 2013 @03:09AM (#5297664)
> Booleans are ordinal values and usually false is less than true.

I was surprised to find this is true,

http://plato.stanford.edu/entries/truth-values/#3

Re:Literals in Programming Languages by jonsen on Thursday February 28, 2013 @03:27AM (#5297710)
So in fact you believed it was false before true then ;-)
Re:Literals in Programming Languages by ibotty on Thursday February 28, 2013 @04:52AM (#5297964)
well i believed that they are not ordered. (which they are not in some languages)
Re:Literals in Programming Languages by tantalor on Thursday February 28, 2013 @10:04AM (#5298915)
That's what I thought, but it appears truth values are typically defined with a partial ordering a <= b iff a && b == a, which gives false <= false < true <= true.

You could choose to ignore that partial ordering at your own peril.

Re:Literals in Programming Languages by cpeterso on Thursday February 28, 2013 @03:47AM (#5297774)
In Visual Basic, False is 0 and True is -1.
Re:Literals in Programming Languages by eterm on Thursday February 28, 2013 @05:23AM (#5298036)
-1 == 1 (mod 2) [But yes, this is Yet Another Reason vb can be irritating to the seasoned programmer.]
Re:Literals in Programming Languages by saurik on Thursday February 28, 2013 @06:53AM (#5298244)
(I always found VB's definition more obvious, given that -1 == ~0.)
Re:Literals in Programming Languages by ubernostrum on Thursday February 28, 2013 @04:20AM (#5297875)
In Python, bool is a subclass of int. The constants True and False have the values 1 and 0 respectively, and it's legal to do arithmetic with them :)