Raise to the Power Operator
The double asterisk symbol (**
) is used to raise a number to the power of another number.
Not what you're looking for? You may be looking for Double Splat for Keyword Arguments.
Here are a couple examples of raising an integer to the power of another integer.
> 4**5
=> 1024
> 5**4
=> 625
How about using it to generate some familiar numbers in the software space:
# how much RAM does my computer need?
> 9.times { |i| puts "#{2 ** i}GB" }
1GB
2GB
4GB
8GB
16GB
32GB
64GB
128GB
256GB