October 2006
Intermediate to advanced
888 pages
16h 55m
English
In Ruby, the multiplication operator (or method) is overloaded to enable repetition of strings. If a string is multiplied by n, the result is n copies of the original string concatenated together:
etc = "Etc. "*3 # "Etc. Etc. Etc. "
ruler = "+" + ("."*4+"5"+"."*4+"+")*3
# "+....5....+....5....+....5....+"Read now
Unlock full access