+ 1
why do we even compare things using the boolen type
true or false
2 Antworten
+ 6
Sometimes you just have to distinguish two states: true or false, 1 or 0, on or off, execution or not.
In such a case, why should you offer countless choices when it comes down to checking whether something is being done or not?
+ 1
Programming is operated in binary logics, the comparison logic has to be in boolean form, true or false, 2 conditions.
Even for multiple choice, you cannot compare all the multiple choices at once, they have to be spitted into multiple binary conditions.
For example:
if(select==choice1) select1(); // boolean for choice 1
else if(select==choice2) select2();// boolean for choice 2
else if(select==choice3) select3();// boolean for choice 3
else selectLast();// boolean for last choice