Skip to content

Instantly share code, notes, and snippets.

@yangsu
Created January 28, 2013 03:32
Show Gist options
  • Select an option

  • Save yangsu/4652806 to your computer and use it in GitHub Desktop.

Select an option

Save yangsu/4652806 to your computer and use it in GitHub Desktop.
Ruby Typing
4 + 4 # g8
4 + "foo" # results in a TypeError, hence strongly typed
4 + 4.0 # => 8.0 this works because of type coercion
# What about this though?
def add_stuff
4 + "foo"
end # => nil
add_stuff # => TypeError This proves that Ruby is dynamically typed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment