Step 7: Strings


Computers may have started out as simple calculators, but obviously they are now able to work with many other types of data. One of these standard data types is text, and in Ruby sequences of characters are called strings. Strings are enclosed in single ('') or double ("") quotation marks.

'A'
"b"
'this is a string'
"Hello World!"
"16"

One detail to remember is that any character on your keyboard, when enclosed in quotation marks, is a string. For example, "1" in Ruby is not the number 1, it is a string of text containing the character "1".