|
Doc Block posted:So, basically, it's just the regular old NOT operator, but because -~=JavaScript Programmers=~- they use it multiple times in a row so it's True Bool Comparison(tm) or something? *refreshes desktop*
|
# ? Oct 27, 2015 04:49 |
|
|
# ? Apr 26, 2024 11:01 |
|
if (YOSPOS.bitch!!!!!!!!!) console.log("rule 36 biotch");
|
# ? Oct 27, 2015 09:10 |
|
! and !! are valuable in C and C++ because while all falses compare equal, not all trues do, so !! is a good (and idiomatic) way to normalize a boolean to 0/1. many (most?) times just ! is enough, as seen for example in the idiomatic implementation of logic XOR: a XOR b -> !a != !b
|
# ? Oct 27, 2015 10:55 |
|
in c++ if all trues don't evaluate equal your compiler is broken
|
# ? Oct 27, 2015 14:43 |
|
well that or some rear end in a top hat put #define true (rand()%2 == 0) or some such in your code
|
# ? Oct 27, 2015 14:45 |
|
hobbesmaster posted:in c++ if all trues don't evaluate equal your compiler is broken in c, integer style trues don't always equal. like 1 and 2 are both true, but not equal. but then you just do if(a && b) but i don't think that comes up very often if you're deliberately using boolean 0 and 1
|
# ? Oct 27, 2015 14:47 |
|
"true" is a keyword
|
# ? Oct 27, 2015 14:53 |
|
do JavaScript programmers really do things like if(!!a == !!b) to see if a & b are both true? instead of just using if(a && b) like a normal person?
Doc Block fucked around with this message at 15:37 on Oct 27, 2015 |
# ? Oct 27, 2015 15:30 |
|
it's to cast a non bool to bool you retard what is hard to understand about it. you'd use it mostly to see if an object is empty or not
|
# ? Oct 27, 2015 17:09 |
|
yes, i know you're casting to bool, i just don't see the point. you make it sound like container classes in javascript override ! to return a bool for whether or not they contain anything, which is p laffo if true IMHO.
|
# ? Oct 27, 2015 19:19 |
|
drool if u bool
|
# ? Oct 27, 2015 19:24 |
|
Doc Block posted:yes, i know you're casting to bool, i just don't see the point. everything does
|
# ? Oct 27, 2015 19:32 |
|
pram posted:it's to cast a non bool to bool you retard what is hard to understand about it. you'd use it mostly to see if an object is empty or not object.isEmpty() simple
|
# ? Oct 27, 2015 19:54 |
|
pram posted:everything does nice
|
# ? Oct 27, 2015 20:01 |
|
Ludwig van Halen posted:object.isEmpty() yes and so is an exclamation mark you goddamned moron
|
# ? Oct 27, 2015 21:24 |
|
reminds me of the accepted way of checking if an element exists on a page with jquery if($('#elemId').length) console.lol("POO");
|
# ? Oct 27, 2015 21:34 |
|
pram posted:yes and so is an exclamation mark you goddamned moron less is more.... or is it?
|
# ? Oct 27, 2015 21:49 |
|
|
# ? Apr 26, 2024 11:01 |
|
echinopsis posted:less is more.... or is it? ! is cool because than you get to say bang. you can even say bang bang bang !!! makes my code very masculine, big time, mmmmmmm rapidash
|
# ? Oct 27, 2015 22:14 |