Shouldn’t there be a warning or error message when try to concatenate a number in this manner?
name = "John Doe"
print “Your name is " << name.length << " characters long.”
outputs:
Your name is characters long.
Shouldn’t there be a warning or error message when try to concatenate a number in this manner?
name = "John Doe"
print “Your name is " << name.length << " characters long.”
outputs:
Your name is characters long.
Shouldn't there be a warning or error message when try to concatenate a
number in this manner?
svg% ri String#<<
-------------------------------------------------------------- String#<<
str << aFixnum -> str
str << anObject -> str
------------------------------------------------------------------------
Append---Concatenates the given object to str. If the object is a
Fixnum between 0 and 255, it is converted to a character before
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
concatenation.
a = "hello "
a << "world" #=> "hello world"
a << 33 #=> "hello world!"
a #=> "hello world!"
svg%
Guy Decoux