Fixed I think. ._.
%i++ and echo(%i); you big silly willy
The reason the code in the OP does not work is mainly because it does not loop at all
function count(%y)
{
%y=0;
if(%y != 10)
{
echo(%y++);
}
}
First of all, the %y=0; would negate the point of having a %y argument
then it tests for if y is equal to ten, since it just got set to zero, this will of course be false.
The it will echo y incremented by one, which is 0+1 = 1
But then it hits the end of the function. To do this in the format you might be looking for...
function count(%y)
{
if(%y < 10)
{
echo(%y++);
count(%y);
}
}
Having it call another count will make it loop back and call the function again, causing %y to again be incremented and echoed, which is exactly what you were trying to do.
That way, if you enter count(0); into the console, it should work correctly.
Another method you might have been trying would be
function count(%y)
{
while(%y<10)
{
echo(%y++);
}
}
which will run all the code inside the while loop until the test (%y<10) is no longer true