simple loop, big problem

Mattebass's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

thanks

Matteo

Ben Bracken's icon

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

Mattebass's icon

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

Mattebass's icon

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