2 ms·
for {set sum 0; set counter 0} {$counter < 10} {incr sum $counter; incr counter} {} It's amusing how that pattern was adopted in Javascript (well, C/Jav
by ljm 5y ago
for {set sum 0; set counter 0} {$counter < 10}
{incr sum $counter; incr counter} {}
It's amusing how that pattern was adopted in Javascript (well, C/Java really I guess) as an optimisation.
for (var sum = 0, counter = 0; counter < 10; sum = counter++) {}
- Koshkin 5y agoBut your JS code has a bug in it while the Tcl code does not.