Skip navigation.
 
mlif statement
FROM : Nathan
DATE : Tue May 27 23:24:42 2008

I'm having a weird problem.... here's my code:

- (IBAction)operators:(id)sender {
   OB=[operatorBar floatValue];
   if (OB=1) {
       [operator setFloatValue: 4];
   }
   if (OB=2) {
       [operator setFloatValue: 5];
   }
}

So you would expect that if operatorBar = 1, then OB will = 1, and 
operator will = 4. I know the first part is ok due to testing, but 
what happens when I run the program is that it acts like the if's 
don't exist, so upon using operators method operator will equal 5 no 
matter what. What's wrong here?

Related mailsAuthorDate
mlif statement Nathan May 27, 23:24
mlRe: if statement Nick Zitzmann May 27, 23:26
mlRe: if statement Wayne Packard May 27, 23:27
mlRe: if statement Nathan May 27, 23:28
mlRe: if statement Nathan May 27, 23:29
mlRe: if statement Nathan May 27, 23:31
mlRe: if statement Scott Ribe May 27, 23:32
mlRe: if statement Andy Lee May 27, 23:35
mlRe: if statement Nathan May 27, 23:35
mlRe: if statement Nathan May 27, 23:35
mlRe: if statement Randall Meadows May 27, 23:37
mlRe: if statement Bob Smith May 27, 23:45
mlRe: if statement Sherman Pendley May 28, 00:04
mlRe: if statement Graham Cox May 28, 02:11
mlRe: if statement Jens Alfke May 28, 05:52
mlRe: if statement Sean McBride May 28, 16:45
mlRe: if statement Sherm Pendley May 28, 17:21