0

is there a way to name a series of objects like so:

for (i=0; i<numberOfObjectsDesired; i++;) {
    Object ("thisone"+i);
    thisone+i = new Object();
}

such that thisone0, thisone1, thisone2, thisone3, ... etc are all unique instances of Objects

1
  • What language are you trying to do this in? Commented Jun 14, 2012 at 20:24

1 Answer 1

2

Sure, it's called an array:

var thisone = new object[numberOfObjectsDesired];

for (i=0; i<numberOfObjectsDesired; i++;) {
    Object ("thisone"+i);
    thisone[i] = new Object();
}

Just note that you have to refer to your instances as thisone[0], thisone[1], etc. instead of thisone0, thisone1, ...

Sign up to request clarification or add additional context in comments.

1 Comment

Snarky but accurate. I like it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.