Skip to content

Instantly share code, notes, and snippets.

@mletterle
Created April 5, 2011 18:04
Show Gist options
  • Save mletterle/904143 to your computer and use it in GitHub Desktop.
Save mletterle/904143 to your computer and use it in GitHub Desktop.
irb(main):001:0> a = [1, 2, 3]
=> [1, 2, 3]
irb(main):002:0> a[1]
=> 2
irb(main):003:0> a[0] + 1
=> 2
irb(main):004:0> a[1] + 1
=> 3
irb(main):005:0> a = ["1", "2", "3"]
=> ["1", "2", "3"]
irb(main):006:0> a[0] + 1
TypeError: can't convert Fixnum into String
from (irb):6:in `+'
from (irb):6
from :0
irb(main):007:0> a[0].to_i + 1
=> 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment