Loops/While: Difference between revisions

Line 753:
return fnTest(d) ? [d].concat(
loopWhile(d, fnDelta, fnTest)
) : [d];
}
 
Line 760:
1024,
function (x) {
return Math.floor(x / 2);
},
function (x) {
return x > 0;
}
).join('\n')
);</lang>
 
If we assume integer division here (Math.floor(x/2)) rather than the floating point division (x/2) used in the imperative example, we obtain the output:
 
<lang JavaScript>512
256
128
64
32
16
8
4
2
1</lang>
 
=={{header|Joy}}==
9,659

edits