Difference between revisions of "Relational and Logical Operators"

From Catglobe Wiki
Jump to: navigation, search
Line 1: Line 1:
<img _fck_mw_template="true" _fckrealelement="0" _fckfakelement="true" src="http://wiki.catglobe.com/extensions/FCKeditor/fckeditor/editor/images/spacer.gif" class="FCK__MWTemplate">
+
 
  
 
=== Relational and Logical Operators  ===
 
=== Relational and Logical Operators  ===
Line 295: Line 295:
  
 
</tbody></table>
 
</tbody></table>
 
&lt;a _fcknotitle="true" href="Category:Operators"&gt;Operators&lt;/a&gt;
 

Revision as of 08:35, 5 January 2012


Relational and Logical Operators

Relational refers to the relationships that values can have with one another, and logical refers to the ways in which true and false values can be connected together. Since the relational operators produce true or false results, they are often used in combination with the logical operators.

The relational operators are as follows:

Not equal to

Operator

Meaning

==

Equal to

 !=

Not equal to

>

Greater than

<

Less than

>=

Greater than or equal to

<=

Less than or equal to

Those relational operators cannot be applied to all data types and in some cases, two values of different types cannot be compared to each other.

<tbody> </tbody>

 

array

bool

number

question

range

string

datetime

array

 

 

 

 

=, !

 

 

bool

 

=, !

=, !

 

 

=, !

 

number

 

=, !

=, !=, >, <, <=, >

 

=, !

 

 

question

 

 

 

 

 

 

 

range

=, !

 

=, !

 

 

 

 

string

 

=, !

=, !

 

 

=, !

 

datetime

 

 

 

 

 

 

=, !=, >, <, <=, >

The outcome of the relational and logical operators is a value of type bool.

<tbody> </tbody>

Operator

Meaning

&&

Logical and

||

Logical or

!

Logical negation