Timeline for Why Use !boolean_variable Over boolean_variable == false
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 5, 2020 at 9:37 | comment | added | controlbox | you are inserting the 'not' where it can't actually go to suit your argument. your first example translates to 'if not the condition is true'. | |
| Feb 26, 2012 at 15:09 | history | made wiki | Post Made Community Wiki by Konrad Rudolph | ||
| Feb 26, 2012 at 11:56 | history | edited | BЈовић | CC BY-SA 3.0 | added 110 characters in body |
| Feb 26, 2012 at 1:02 | comment | added | BЈовић | @S.Robins I find stupid name of boolean for a boolean variable. Something like for example isVisible would be a better example. Then if (!isVisible) would mean if not visible - which is simpler to understand then if (isVisible==false), which is an inverse logic. Hope it's clearer now. Or, did I misunderstood your comment? | |
| Feb 26, 2012 at 0:53 | comment | added | S.Robins | !true means not true. !boolean means either not false or not true depending on the value of the boolean, which itself is logical inversion. | |
| Feb 25, 2012 at 20:43 | history | answered | BЈовић | CC BY-SA 3.0 |