Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rwpr/8d72d23b883fbaea7296 to your computer and use it in GitHub Desktop.
Save rwpr/8d72d23b883fbaea7296 to your computer and use it in GitHub Desktop.
~ irb
irb(main):001:0> def say_hi(name)
irb(main):002:1> puts "Hi " + name
irb(main):003:1> end
=> :say_hi
irb(main):004:0> say_hi("Ruui & Josh")
Hi Ruui & Josh
=> nil
irb(main):005:0> a = [5,4,3,2,1]
=> [5, 4, 3, 2, 1]
irb(main):006:0> a
=> [5, 4, 3, 2, 1]
irb(main):007:0> a.sort!
=> [1, 2, 3, 4, 5]
irb(main):008:0> a
=> [1, 2, 3, 4, 5]
irb(main):009:0> a.inspect
=> "[1, 2, 3, 4, 5]"
irb(main):010:0> Math.sqrt(1282)
=> 35.805027579936315
irb(main):011:0> Time.now
=> 2015-07-06 15:43:27 +0800
irb(main):012:0> Array.new(10,'bee')
=> ["bee", "bee", "bee", "bee", "bee", "bee", "bee", "bee", "bee", "bee"]
irb(main):013:0> include Math
=> Object
irb(main):014:0> sqrt 64
=> 8.0
irb(main):015:0> nil.object_id == a.object_id
=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment