Why do this two do while loops produce different output?
var dataLen4 = 4; var idx = 0; do { console.log("1. idx:", idx, idx << 2); ++idx; } while(idx < dataLen4 ); /* output 1. idx: 0 0 1. idx: 1 4 1. idx: 2 8 1. idx: 3 12 */ idx=0; do { console.log("2. idx:", idx, idx << 2); } while(++idx < dataLen4 ); /* output 2. idx: 0 0 2. idx: 2 8 2. idx: 3 12 */
Code was running on a PICO_R1_3 with 2v06.49.
@MaBe started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Why do this two do while loops produce different output?
Code was running on a PICO_R1_3 with 2v06.49.