|
|
|
|
|
by dietrichepp
902 days ago
|
|
Choosing false = 0 and true = 1 is putting the cart before the horse. It is equally true that 1*0=0 is the same as false|true=true, and 0+1=1 is the same as true&false=false. But it is also not true that 1+1=1, so it is probably wrong to equate 'or' with '+'. The operation has the wrong properties. As someone who sometimes dabbles in electronics, 0 = true makes a lot of intuitive sense to me. You have your pin with an open collector, your pull-up resistor, and “true” (as in, it is true that the transistor is conducting) pulls the voltage to ground, which is 0. As someone who uses a Unix shell, 0 = true makes a lot of intuitive sense to me. $ true; echo $?
0
$ false; echo $?
1
|
|