gen~ codebox for loop

Mar 12, 2013 at 3:27pm

gen~ codebox for loop

I’m trying to make a for loop with gen but don’t know how to do…
but maybe there’s another way to do than using a for loop…

here’s what I try to do.

for example
if I input 3, I’d like the output to be (1*1) + (2*2)
if I input 4, I’d like the output to be (1*1) + (2*2) + (3*3)
if I input 5, I’d like the output to be (1*1) + (2*2) + (3*3) +(4*4)

I’m sure it’s simple to do.
any idea ?

Thank you.

#67035
Mar 12, 2013 at 6:30pm

I found this, but maybe there’s a better way.

– Pasted Max Patch, click to expand. –
#241254
Mar 12, 2013 at 6:38pm

Here’s another solution

– Pasted Max Patch, click to expand. –
#241255
Mar 13, 2013 at 3:06am

nice, it’s what I thought could be possible with for.
it’s more efficient. (0.00028 cpu with my technique, 0.00017 cpu with yours)
thank you wesley,

#241256

You must be logged in to reply to this topic.