• 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
naming variables on the fly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

naming variables on the fly


  • Subject: naming variables on the fly
  • From: Peter Browne <email@hidden>
  • Date: Wed, 8 Jun 2005 09:43:32 +0100

I apologize if this is a silly question, but I was wondering if/how it is possible to dynamically name variables as they are created. For instance, normally you would choose the name for a variable like

int i;

or NSString *aString;

but is there any way to program a situationally dependent replacement for "i" or "aString". The only situation i can think of for this is if, for some reason, you needed to initialize a varying number of objects belonging to a custom class. Orr as a time saving measure, for instance if you wanted to initialize 20 different NSArrays could you do something along the lines of a:

for (someNumber = 0; someNumber <= 20; someNUmber++)
{
	NSArray *aDifferentNameEachTime = [[NSArray alloc] init];
}

Any thoughts?

Pete

_______________________________________________
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: naming variables on the fly
      • From: "M. Uli Kusterer" <email@hidden>
  • Prev by Date: tabbing with nextKeyView
  • Next by Date: Why are BOOL and bool distinct types?
  • Previous by thread: tabbing with nextKeyView
  • Next by thread: Re: naming variables on the fly
  • Index(es):
    • Date
    • Thread