E
Erik the Red
http://www.math.umd.edu/~dcarrera/ruby/0.3/chp_02/while.html
The code is as follows:
number = 1
while number < 10_000
number *= 2
end
number /= 2
puts number.to_s + " is the highest " +\ "power of 2 less than 10,000"
I don't quite understand this, especially since:
a. His program output is clearly not correct. 16 384 is greater than 10
000.
b. His comments don't make sense.
What does this code do exactly?
The code is as follows:
number = 1
while number < 10_000
number *= 2
end
number /= 2
puts number.to_s + " is the highest " +\ "power of 2 less than 10,000"
I don't quite understand this, especially since:
a. His program output is clearly not correct. 16 384 is greater than 10
000.
b. His comments don't make sense.
What does this code do exactly?