2 int main (int argc, const char *argv[])
3 {
4 NSLog (@"Hello, Objective- C!");
5 return (0);
6 } // main
2 // returns NO if the two integers have the same
3 // value, YES otherwise
4 BOOL areIntsDifferent (int thing1, int thing2)
5 {
6 if (thing1 == thing2)
7 {
8 return (NO);
9 }
10 else
11 {
12 return (YES);
13 }
14 } // areIntsDifferent
15
16 // given a YES value, return the human- readable
17 // string "YES". Otherwise return "NO"
18 NSString *boolString (BOOL yesNo)
19 {
20 if (yesNo == NO)
21 {
22 return (@"NO");
23 }
24 else
25 {
26 return (@"YES");
27 }
28 } // boolString
29
30 int main (int argc, const char *argv[])
31 {
32 BOOL areTheyDifferent;
33 areTheyDifferent = areIntsDifferent (5, 5);
34 NSLog (@"are %d and %d different? %@", 5, 5, boolString(areTheyDifferent));
35 areTheyDifferent = areIntsDifferent (23, 42);
36 NSLog (@"are %d and %d different? %@", 23, 42, boolString(areTheyDifferent));
37 return (0);
38 } // main