Gen function declaration

Ruslan's icon

Hi,

I would like to ask a question to people who are familiar with gen.
I'm trying to implement a factorial function like this:

factorial(N) {
    if (N
        return 1;
        }
    result=2;
    for (i=3; i
        result=(i+alpha+1)*i;
        }
        return result;
    }

However I get the "statement missing ;" in a first line.

Can you point me out whats wrong with this function. This example is from JavaScript book.

The Max version I use is 6.1.7 32 Bit on Windows 7.

Emmanuel Jourdan's icon

Gen~ doesn't have a ++ operator. You have to use something like i += 1.

Ruslan's icon

Thank you Emmanuel, I will look into this.