Forums > Gen

gen~ codebox for loop

March 12, 2013 | 3:27 pm

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.


March 12, 2013 | 6:30 pm

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

– Pasted Max Patch, click to expand. –

March 12, 2013 | 6:38 pm

Here’s another solution

– Pasted Max Patch, click to expand. –

March 13, 2013 | 3:06 am

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,


Viewing 4 posts - 1 through 4 (of 4 total)