simple loop, big problem

Dec 19, 2013 at 12:17pm

simple loop, big problem

Hi everybody,
I’ve just begun to work with Js and I’m an absolute noob, so
I can’t figure out why this simple loop doesn’t functions.
Any advice would be precious
<code>

– Pasted Max Patch, click to expand. –

</code>

thanks

Matteo

#276238
Dec 19, 2013 at 12:30pm

Hi Matteo,

Can you paste in your JS code? It doesn’t get saved with the patcher, so in your patch, the JS object is empty.

-Ben

#276239
Dec 19, 2013 at 12:37pm

Ouch..I’m sorry
Here It is
Thanks

function list() {
var delta = new Array();

for (i = 0; i < arguments.length; ++i) {
if (i = 0)
delta[0] = arguments[0];
else
delta[i] = arguments[i] – arguments[i-1];
}

outlet(0, delta);
}

#276241
Dec 19, 2013 at 12:56pm

Ok…It was really stupid, in the if statement I’v assigned and not checked i

#276242

You must be logged in to reply to this topic.