Website hosting service by

 Back to Index


So that's numbers... but what about letters? Words? Text?

The word we use for groups of letters is string. Here are some strings:

  • "Hello."
  • "Ruby rocks."
  • "5 is my favorite number... what's yours?"
  • "Snoopy says #%^?&*@!"

Some things you can do with strings

Ruby lets you do several nifty things with strings.

Here is a good way to remember this: '"hi " * 3' is the same as '"hi " + "hi " + "hi "' so it gives me "hi hi hi ".

Notice what happens if I forget the space in "hi ":

Now see what happens here:

When Ruby sees "1" it sees a string, not a number.

More things you can do with text

Here are some more nifty things you can do with text:


  1. What do you expect this will do:

    >> 'hello'.length + 'world'.length

    Try it.

  2. Play around with strings for a bit.





2002-2004 Website Hosting Service

Buy domain name at only $5.95/yr with comprehensive domain hosting services. Domain registration and domain search service from $5.95 Cheap domain name registration and domain transfer service

Disclaimer: This documentation is provided only for the benefits of our website hosting customers.
For authoritative source of the documentation, please refer to