Created
January 28, 2013 03:32
-
-
Save yangsu/4652806 to your computer and use it in GitHub Desktop.
Ruby Typing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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