The while loop is seperate from the ascent loop but you got that right with how ascent works.piruchan wrote:
I tried looking for the meaning of "ascent" but found nothing.Granger wrote:
Am i retarded or something?let x = 5;What is the value of x after the code has been executed?
while(x<10){x++;}
ascent(i in 6..23){
x = i/2;
}
if(x==(23/2)){x = 25;}else{x = 23;}I'm probably wrongAssuming thatascent(i in 6..23)means the value of i goes up from 6, 7, 8, ... 23 for each loop, then the final value of i would be 10 because x goes from 5 to 9.
First loop: x=5, i=6
Second loop: x=6, i=7
Third loop: x=7, i=8
Fourth loop: x=8, i=9
Fifth loop: x=9, i=10
The loop then stops because the condition is x<10.
If this is true than x won't reach 23/2, so the value of x after the code is executed would be 23.
I think that we could ignore the while loop in its entirety actually, as the ascent loop has no condition regarding x, it just runs untill i=23 starting with i=6 and incrementing i by one with each loop. I think.