0
š“Final Answer 3/3šµ but first read process
š“Final Answer 3/3šµ but first read process x=8 x/=2 y=1 x.times{y+=2} puts y ................................... I understand this: x=4 4.times{1+2} puts y Correct Output Answer 9
1 Answer
+ 6
x = 8 # let x = 8
x /= 2 # now divide x by 2 then assign that value to x; so now x = 4
y = 1 # let y = 1
x.times{ y += 2 } # run the code inside the curly braces x amount of times.
4.times { y += 2 } or 4.times { y = y + 2 }
# here y += 2 means y = y + 2
1. y += 2 # y = 3
2. y += 3 # y = 5
3. y += 5 # y = 7
4. y += 7 # y = 9
puts y # print y is 9