ios - Xcode 6 if else statements getting an error of "Expected identifier or '(' -


my goal create person class name , gender, set name , set gender 1 or 0 (1 male or 0 female). later able print out name , gender (i.e. name: chris , gender:male) therefore need change 1 or 0 male or female. first time have ever attempted xcode new , sorry if making foolish mistake here. created new class , have person.h , person.m.

person.h:

    #import <foundation/foundation.h>      @interface person : nsobject{     nsstring *name;     nsstring *gender;     }     @end 

person.m

    #import "person.h"      @implementation person     nsstring *name = @"john snow";     nsstring *gender =@"1";      if (self.gender = 1){     nsstring *gender =@"male";     }     else if (gender = 0){     nsstring *gender =@"female";     }     else{     nsstring *gender =@"unknown";     }@end 

everything appears compile until add if statements, if statement give me error of "expected identifier or '('. maybe overthinking , confusing myself more, not looking work me, push in right direction great.

person.h should be:

#import "person.h"      @implementation person     nsstring *name = @"john snow";     nsstring *gender =@"1";      if (self.gender == 1){     nsstring *gender =@"male";     }     else if (gender == 0){     nsstring *gender =@"female";     }     else{     nsstring *gender =@"unknown";     }@end 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -