• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
if statement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

if statement


  • Subject: if statement
  • From: Nathan <email@hidden>
  • Date: Tue, 27 May 2008 17:24:42 -0400

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?
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • [moderator] Re: if statement
      • From: Scott Anguish <email@hidden>
    • Re: if statement
      • From: Sherman Pendley <email@hidden>
    • Re: if statement
      • From: Scott Ribe <email@hidden>
    • Re: if statement
      • From: Wayne Packard <email@hidden>
    • Re: if statement
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: File's Owner
  • Next by Date: Re: if statement
  • Previous by thread: Re: Okay I have those pieces... now where's the g lue?
  • Next by thread: Re: if statement
  • Index(es):
    • Date
    • Thread