Sunday, 8 September 2013

Why dosn't this objective-c if statement work?

Why dosn't this objective-c if statement work?

I's sorry but I'm new to Xcode and coding.
Im trying to create an If statement so that if label 3 = or greater then
20 label 4 = 0, else if lower then 20 it = 1 and if lower then 18.5 its =
2.
this is my code for that:
if (_label3.text >= @"20") {_label4.text = @"0";}
else if (_label3.text < @"20") {_label4.text = @"1";}
else if (_label3.text <= @"18.5") {_label4.text = @"2";}
I'm not sure what is going wrong, but i am getting this error 'Direct
comparison of String literal has undefined behavior' and Xcode wont let me
build the app.
Thank for your Help

No comments:

Post a Comment