Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to loop true var1 to var#?

Status
Not open for further replies.

Petal

Programmer
Jun 8, 2001
56
NO
I have the string variabels var1 to var# that I will like to loop true.

How can I do thies, when I don't know how many var# the are?

 
I don't quite get what you are trying to accomplish. But since you are creating String variables with the name of 'var#', you will definately need a variable to keep track of the next number so that you wouldn't create an instance of the same variable name again.

But I can't see how you can create variable names dynamically..??

Anyway if you want another solution, you can add your created Strings to an ArrayList. Just call the .size() method from the ArrayList class and you will be able to get the number of variables you have created.

Hope this helps,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top