Skip to content

Instantly share code, notes, and snippets.

@brandoncc
Created September 13, 2014 03:26
Show Gist options
  • Save brandoncc/8439120ebd565fd5e69d to your computer and use it in GitHub Desktop.
Save brandoncc/8439120ebd565fd5e69d to your computer and use it in GitHub Desktop.
irb(main):001:0> def doubler(start)
irb(main):002:1> puts start
irb(main):003:1> end
=> nil
irb(main):004:0>
irb(main):005:0* doubler(2)
2
=> nil
irb(main):006:0> doubler(4)
4
=> nil
irb(main):007:0> doubler(8)
8
=> nil
--------------------------
irb(main):001:0> def doubler(start)
irb(main):002:1> puts start
irb(main):003:1>
irb(main):004:1* if start < 10
irb(main):005:2> doubler(start * 2)
irb(main):006:2> end
irb(main):007:1> end
=> nil
irb(main):008:0> doubler(2)
2
4
8
16
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment