### 第11节：Objective-C 关系运算符

==检查是否两个操作数的值等于或不等于，如果是的话那么条件为真。(A == B) is not true.
!=检查两个操作数的值等于或不相等，如果值不相等，则条件为真。(A != B) is true.
>检查是否左操作数的值大于右操作数的值，如果是的话那么条件为真。(A > B) is not true.
<检查是否左操作数的值小于右操作数的值，如果是的话那么条件为真。(A < B) is true.
>=检查是否左操作数的值大于或等于右操作数的值，如果是的话那么条件为真。(A >= B) is not true.
<=检查是否左操作数的值小于或等于右边的操作数的值，如果是的话那么条件为真。(A <= B) is true.

## 例子

```#import <Foundation/Foundation.h>

main()
{
int a = 21;
int b = 10;
int c ;

if( a == b )
{
NSLog(@"Line 1 - a is equal to b
" );
}
else
{
NSLog(@"Line 1 - a is not equal to b
" );
}
if ( a < b )
{
NSLog(@"Line 2 - a is less than b
" );
}
else
{
NSLog(@"Line 2 - a is not less than b
" );
}
if ( a > b )
{
NSLog(@"Line 3 - a is greater than b
" );
}
else
{
NSLog(@"Line 3 - a is not greater than b
" );
}
/* Lets change value of a and b */
a = 5;
b = 20;
if ( a <= b )
{
NSLog(@"Line 4 - a is either less than or equal to  b
" );
}
if ( b >= a )
{
NSLog(@"Line 5 - b is either greater than  or equal to b
" );
}
}```

```2013-09-07 22:42:18.254 demo Line 1 - a is not equal to b
2013-09-07 22:42:18.254 demo Line 2 - a is not less than b
2013-09-07 22:42:18.254 demo Line 3 - a is greater than b
2013-09-07 22:42:18.254 demo Line 4 - a is either less than or equal to  b
2013-09-07 22:42:18.254 demo Line 5 - b is either greater than  or equal to b```

0