Jump to content

What does ! mean?


李立峰

Recommended Posts

! on its own by default with boolean variable like if(!something) would check if value is NOT true (I.E false), adding second if(!!something) would reverse previous comparison to check value IS true, so as you add more exclamation marks it would give opposite comparison to previous, NOT true, IS true, NOT true and so on....

 

Where

if(!something) //not true

 

or

 

if(something) // is true

 

would suffice

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...