in reply to Re^2: order of arguments evaluated
in thread order of arguments evaluated

Indeed both are good suggestions, but the context was putting together HTML tables, hence a simple join wasn't satisfactory.

The second solution was also good, but I was concerned about integer wrap-around, which could potentially evaluate to zero in the case of a HUGE table (being the paranoid programmer that I am, even though the likelihood of generating a 4,294,967,296 row table was unlikely).

Hence the dodgy trinary operator statement.

Replies are listed 'Best First'.
Re^4: order of arguments evaluated
by Roy Johnson (Monsignor) on Jun 01, 2005 at 00:33 UTC
    My second solution, like yours, will only increment the variable if it is zero, because logical-or is a short-circuiting operation.

    Before you get done generating a multi-billion-row table, I think you're going to have problems with browser timeout. :-)


    Caution: Contents may have been coded under pressure.