I have a code as follows:
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSString *article = self.textField_artcile.text;
int article_int = [article intValue];
NSString *prim = self.textField_prim.text;
int prim_int = [prim intValue];
NSString *part = self.textField__part.text;
int part_int = [part intValue];
if (prim_int == 0) {
int myVal = [[NSString stringWithFormat:@"%d%d",article_int,part_int] intValue];
//short myVal
}
else {
int myVal = [[NSString stringWithFormat:@"%d%d%d",article_int,prim_int,part_int] intValue];
//long myVal
}
NSLog(@"myVal %d",myVal); <<<this line returns error 'Use of undeclared identifier 'myVal'
[self.view endEditing:YES];
}
It is expected that after end of editing myVal will be returned (short one or long one)