May 2021 1 96 Report
"Expected Expression" error in Xcode?

Code:

-(IBAction)calculate:(id)sender {

float m = ([variableM.text floatValue]);

float x = ([variableX.text floatValue]);

float y = ([variableY.text floatValue]);

float a = m*x;

float b = a+y;

//////////ERROR BEGINS HERE//////////

if (float b > 0) {

positive.hidden = YES;

}

else {

positive.hidden = NO;

}

//////////ERROR ENDS HERE//////////

answerB.text = [[NSString alloc] initWithFormat:@"%2.f", b];

answerM.text = [[NSString alloc] initWithFormat:@"%2.f", a];

}

I have no idea what's wrong with the code. 10 points for best answer!

Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Helpful Social

Copyright © 2024 Q2A.ES - All rights reserved.