Message 1 of 1
How to create a series of variable/object names by loops

Not applicable
05-05-2015
11:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
for example, I would like to realize the same as below in maxscript, so I can automatically create string1, string2, string3 and asign them values at the same time by a loop.
d={} for x in range(1,10): d["string{0}".format(x)]="Hello" In [7]: d["string5"] Out[7]: 'Hello' In [8]: d Out[8]: {'string1': 'Hello', 'string2': 'Hello', 'string3': 'Hello', 'string4': 'Hello', 'string5': 'Hello', 'string6': 'Hello', 'string7': 'Hello', 'string8': 'Hello', 'string9': 'Hello'}