#426. Growing sum
When the green flag is clicked, this script runs. When the loop ends, what is the value of the **i** variable?
when green flag clicked set [s v] to (0) set [i v] to (0) repeat until <(s) > (16)> change [i v] by (1) change [s v] by (i) end
# When the green flag is clicked
s = 0
i = 0
while not (s > 16):
i += 1
s += i
let s = 0, i = 0;
// When the green flag is clicked
s = 0;
i = 0;
while (!(s > 16)) {
i += 1;
s += i;
}
💡 Not sure? Build it in Scratch and try it out.