I do not like to use
while loops in Ruby. I was wondering how I can generate a "squared sequence" (e.g., squares the first input, then squares the outcome, etc.) in a more idiomatic Ruby way than this one:
value = 2 while value < 10000 puts value = value**2 end # => 4 # 16 # 256 # 65536
I have a suspicion that there is a way/method to do this, but I do not know which one. I hope someone can point me in the right direction.