Ruby is a dynamically typed , strictly-typed (or "strongly typed") language, Lua is another such language. The first means that variables can contain any class of values. The latter - what you use means that type enforcement does not happen automatically.
JavaScript, . JavaScript var x = [] + false;, - . , JavaScript "1" + 1 == "11", "1" - 1 == 0. Ruby .
:
puts income.to_i - bills.to_i
, , Ruby, , . :
class Person
def +( something )
if something.is_a?(Numeric)
self.weight += something
elsif something.is_a?(Time)
self.age += something
else
raise "I don't know how to add a #{something.class} to a Person."
end
end
end
.