Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class Exponate
  2. attr_accessor :args
  3.  
  4. def initialize args = {}
  5. @args = args
  6. @ans = nil
  7. end
  8.  
  9. def index
  10. @args[:b].times {
  11. @ans = @args[:a] * @args[:a]
  12. }
  13. puts @ans
  14. end
  15. end
  16.  
  17. e = Exponate.new(:a => 32, :b => 6)
  18. e.index
  19.  
  20. e.args[:a] = 5
  21. e.index
  22.  
  23. 1024 # Should be 1_073_741_824
  24. 25 # Should be 15_625
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement