Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Exponate
- attr_accessor :args
- def initialize args = {}
- @args = args
- @ans = nil
- end
- def index
- @args[:b].times {
- @ans = @args[:a] * @args[:a]
- }
- puts @ans
- end
- end
- e = Exponate.new(:a => 32, :b => 6)
- e.index
- e.args[:a] = 5
- e.index
- 1024 # Should be 1_073_741_824
- 25 # Should be 15_625
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement