Forums > Javascript

simple loop, big problem

December 19, 2013 | 12:17 pm

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


December 19, 2013 | 12:30 pm

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


December 19, 2013 | 12:37 pm

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);
}


December 19, 2013 | 12:56 pm

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


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