Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
maniacdevnull
Apr 18, 2007

FOUR CUBIC FRAMES
DISPROVES SOFT G GOD
YOU ARE EDUCATED STUPID

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*

Adbot
ADBOT LOVES YOU

Valeyard
Mar 30, 2012


Grimey Drawer
if (YOSPOS.bitch!!!!!!!!!) console.log("rule 36 biotch");

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
! 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

hobbesmaster
Jan 28, 2008

in c++ if all trues don't evaluate equal your compiler is broken

hobbesmaster
Jan 28, 2008

well that or some rear end in a top hat put #define true (rand()%2 == 0) or some such in your code

Baxate
Feb 1, 2011

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

hobbesmaster
Jan 28, 2008

"true" is a keyword

Doc Block
Apr 15, 2003
Fun Shoe
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

pram
Jun 10, 2001
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

Doc Block
Apr 15, 2003
Fun Shoe
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.

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

drool if u bool

pram
Jun 10, 2001

Doc Block posted:

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.

everything does

Baxate
Feb 1, 2011

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

echinopsis
Apr 13, 2004

by Fluffdaddy

pram posted:

everything does

nice

pram
Jun 10, 2001

Ludwig van Halen posted:

object.isEmpty()

simple

yes and so is an exclamation mark you goddamned moron

Valeyard
Mar 30, 2012


Grimey Drawer
reminds me of the accepted way of checking if an element exists on a page with jquery

if($('#elemId').length) console.lol("POO");

echinopsis
Apr 13, 2004

by Fluffdaddy

pram posted:

yes and so is an exclamation mark you goddamned moron

less is more.... or is it?

Adbot
ADBOT LOVES YOU

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

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

  • Locked thread