Other Pages



String Messages

A string understands lots of messages. Here are a few:

"Fig Newton".swapcase

Try all of these out in irb!

String Operators

A string knows DOT, but also understands several other operators:

"blue" + "berry"
"yum" * 10

+ * and [] are pronounced PLUS, TIMES, and SUB

Try these out in irb!

Combining Messages and Operators

You can combine messages and operators at will.

"grape".reverse * 10 + "!!!"

Definitely try these out in irb! It's pretty fun.

LAB: Playing With Strings