Notifications
Clear all
[Closed] simple quistion
Mar 16, 2013 8:39 pm
Hi everybody …
im starting to learn maxscript …
and i got this question :
for x = 1 to 5 do
(
???
)
i want inside the loop to create variable called (a+the x value from the loop)
a1
a2
a3
a4
a5
4 Replies
Mar 16, 2013 8:39 pm
You can’t do it. Try with arrays – in loop fill the array and use its elements as variables.
Mar 16, 2013 8:39 pm
The more important answer is “there is no reason you should want to do it”.
Mar 16, 2013 8:39 pm
codeTxt = ""
for x = 1 to 5 do
(
codeTxt += "a" + ( i as string) + " = undefined
"
)
execute codeTxt
Mar 16, 2013 8:39 pm
arrays are your friend
multi-dimensional arrays are your girlfriend
(
varr = for a = 1 to 5 collect #(a,a*(random 4 10))
for v = 1 to varr.count do format "% <-- value of a product of a*% --> %
" varr[v][1] (varr[v][2]/varr[v][1]) varr[v][2]
)
beware: girlfriends can drive you mad