objective c - multiple if condition -


if ( ([mobilenumber.text hasprefix:@"8"] == no)  ||     ([mobilenumber.text hasprefix:@"9"] == no) ) { } 

i wanna test if mobilenumber has prefix of 8 or 9. doing wrong here?

answer: silly me, should , condition instead of or.

should be

if(([mobilenumber.text hasprefix:@"8"] == no) && ([mobilenumber.text hasprefix:@"9"] == no)) {   /* mobile number not have 8 or 9 in beginning */ } 

my comment above make sure there isn't ( in front of mobile number.

edit: did not quite understand after.


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -