Geeks With Blogs
Stephanie Grima C#, ASP.NET and my life.

The Basics : Relational Operators used in coding

 

Both in Java and .NET (especially in terms of C#), the same relational operators and syntax are used in conditions. Below find them listed together with a definition and an example of each:

 

Operator:
Definition
Example:
Meaning:
less than
If (x < y) {

}
 
If x is less than y… do something
greater than
If (x > y) {

}
 
If x is greater than y… do something
<=
less or equal to
If (x <= y) {
.=
}
If x is less or equal to y… do something
 
>=
greater or equal to
If (x >= y) {

}
If x is greater or equal to y… do something
 
==
equal to
If (x == y) {

}
 
If x is equal to y… do something
!=
not equal to
If (x !=y) {

}
 
If x is not equal to y… do something

Posted on Tuesday, October 21, 2008 8:35 AM C# , Java | Back to top


Comments on this post: The Basics : Relational Operators used in coding

# re: The Basics : Operators used in coding
Requesting Gravatar...
Nice articles well done. However I would correct the title to "Comparison Operators". There are quite a few different operators like arithmetic, bitwise and logic to mention a few - which are not included in the table.
Left by William Farrugia on Oct 23, 2008 1:25 AM

# re: The Basics : Relational Operators used in coding
Requesting Gravatar...
You are right, the title was quite complex considering the few I wrote here. I changed the title to "Relational Operators". I think it fits better. Thanks for the comment :-)
Left by Steffi on Oct 29, 2008 9:57 AM

Your comment:
 (will show your gravatar)


Copyright © Steffi | Powered by: GeeksWithBlogs.net