#494. Doubling up
When the green flag is clicked, this script runs. What is the value of the **c** variable?
when green flag clicked set [v v] to (1) set [c v] to (0) repeat until <(v) > (502)> set [v v] to ((v) * (2)) change [c v] by (1) end
# When the green flag is clicked
v = 1
c = 0
while not (v > 502):
v = v * 2
c += 1
let v = 0, c = 0;
// When the green flag is clicked
v = 1;
c = 0;
while (!(v > 502)) {
v = v * 2;
c += 1;
}
💡 Not sure? Build it in Scratch and try it out.