Comparison operators

The comparison operator returns a Boolean true if the statement is true or a Boolean false if the statement is not true.

Here are some prototypes:

Equality:   
  varA == varB 
Not equal:   
  varA != varB 
Greater than:   
  varA > varB 
Less than:   
  varA < varB 
Greater than or equal to:   
  varA >= varB 
Less than or equal to: 
  varA <= varB 

Here are some examples:

2 == 1 //false, 2 does not equal 1 
2 != 1 //true, 2 does not equal 1 
2 > 1 //true, 2 is greater than 1 
2 < 1 //false, 2 is not less than 1 
2 >= 1 //true, 2 is greater or equal to 1 
2 <= 1 //false, 2 is not less or equal to 1 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset