views:

114

answers:

1

I don't understand why this doesn't work:

[abc = ([def intValue] - 71) * 6];

'*' should be the viable way of doing multiplication and 'abc' is defined as an NSInteger. ('def' is an NSString)

+9  A: 

Use e.g. the following instead:

NSInteger abc;
abc = ([def intValue] - 71) * 6;

Not everything in Objective-C is of class-type, e.g.:

  • NSInteger
  • NSUInteger
  • NSPoint
  • ...

I also don't know where you got that idea of doing the assignment inside the square brackets in the first place - i strongly recommend to read through the Introduction to The Objective-C Programming Language.

Georg Fritzsche