• 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...then statements
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

If...then statements


  • Subject: If...then statements
  • From: Connor Wakamo <email@hidden>
  • Date: Sat, 4 Jun 2005 17:44:54 -0400

Hello,
I am using an If statement to compare the stringValue of a NSTextField to another string to determine what to do next.  It does what's inside of the If statement regardless of whether it's true or not.  So, if the stringValue of loc is equal to Lab (or anything, really) it executes both pieces of the code.  Here's the code I'm using:
    if([loc stringValue] == @"Lab")
    {
        [loc setStringValue:@"Ground Floor"];
        [act setStringValue:@"You decide to enter the simulator and do his Adventure.\nSCIENTIST: Very well, step inside and I'll get you in there.  The old way of succeeding won't work anymore, so you've got to find the new way out.  Instead of the Finish portal, there is a Quit portal.  The Finish portal is in a completely different place.\nYou then are put into the Tutorial Tower and see the same sign from before.  You skip reading it and press the right button.  Two doors open, however.\nYou now have a choice.  You can either go through door number 1 or door number 2.\nOption 1 - Door Number 1\nOption 2 - Door Number 2"];
    }
    if([loc stringValue] == @"Welcome Screen")
    {
        [loc setStringValue:@"Lab"];
        [act setStringValue:@"You walk into a lab.\nSCIENTIST: Hello, hello, hello!  Welcome to my lab!  I've set up a new Tutorial Tower... Do you want to go in?\nOption 1 - Enter\nOption 2 - Don't Enter"];
    }

Thanks,
Connor
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: If...then statements
      • From: Steve Palmer <email@hidden>
    • Re: If...then statements
      • From: Tony Cate <email@hidden>
  • Prev by Date: Re: NSStatusItem cleanup
  • Next by Date: Re: If...then statements
  • Previous by thread: Re: Refaulting Core Data Objects.
  • Next by thread: Re: If...then statements
  • Index(es):
    • Date
    • Thread