For (var i = 10; --i >= 1; ) doesn't work in the javascript engine


If you change

for (var i = 1; i < 10; ++i)


for (var i = 10; --i >= 1; )

in the javascript demo,

you get error "Line 19, column 25 : Found ')' when expecting an expression"


Thanks - fixed now!



could we possibly have Math.floor and Math.ceil implemented as well?


Sure, I'll add those when I get a moment.


Thanks for the roof and floor

Two more things, in Javascript semicolon is only neccessary between statements if they're on the same line, its therefore fully legitimate to write code like

for (var i = 10; --i >= 0;)
    Demo.print (i / 10)  // no semi needed here

Moreover, this code is expected to output a series of decimal numbers, 0.9 0.8 0.7  ..  0.1 0. Which it doesn't. It produces only ten zeroes.

It seems there is some form of integer arithmetics going on here. As far as I know, javascript doesn't have integers. Only floating point numbers.


Ok, I've sorted out the integer division thing.

Sigh.. parsing the newlines without semicolons will be a pain - no time to do that right now, but thanks for the heads-up.


Well I guess most of us can live with the semicolon issue. After all, you get a verbose slap on your fingers for every "missing" semi which will help you toe the line...