0

Is there a way to create a certain number of double variables based on user input. For example a user has three cars so when asked by the software how many vehicles he has and he enters the number 3 my software will create 3 double variables named car01, car02, car03 for example. I've been googling this and can't seem to find a way to do it without just adding a bunch of variables that will not be used. Thanks if anyone can help.

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by JamesCherrill
0

No, you can't create variables like car01 at runtime. You can use a Map(like HashMap) and save data in it using a key = "car01" with any value you want.

0

No, you can't create variables like car01 at runtime. You can use a Map(like HashMap) and save data in it using a key = "car01" with any value you want.

Aww man that would have saved a lot of work lol.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.