type inference
.TypeError
but we don’t have to care about types in Ruby ( or not :)). This is also a runtime error
meaning that your program just crashed at runtime (definitely not good).Int32#+
and showed us the possible overloads. This is a compile time error
meaning that our code didn’t compile and we catch the error before running the program. Lovely!Number
s.type restriction
on x
and y
. We restricted them to be Number
and Crystal is smart enough to stop us from using the method with a String
.Method Overloading
.add
method and make it work with a String.