These numbers have the same value, 1,234. The underscore may be used to
enhance readability for humans. You may place an underscore anywhere in
the number.

Floating point numbers may be written as follows:

12.341234e-21.234E1

These numbers have the same value, 12.34. You may use underscores in
floating point numbers as well.

You can use a special prefix to write numbers in decimal, hexadecimal,
octal or binary formats. For decimal numbers use a prefix of
0d, for hexadecimal numbers use a prefix of 0x,
for octal numbers use a prefix of 0 or 0o, for
binary numbers use a prefix of 0b. The alphabetic component
of the number is not case-sensitive.

Examples:

0d1700D1700xaa0xAa0xAA0Xaa0XAa0XaA02520o2520O2520b101010100B10101010

All these numbers have the same decimal value, 170. Like integers and
floats you may use an underscore for readability.

Any other character followed by a backslash is interpreted as the character
itself.

Double-quote strings allow interpolation of other values using
#{...}:

"One plus one is two: #{1 + 1}"

Any expression may be placed inside the interpolated section, but it's
best to keep the expression small for readability.

Interpolation may be disabled by escaping the “#” character or using
single-quote strings:

'#{1 + 1}'#=> "\#{1 + 1}"

In addition to disabling interpolation, single-quoted strings also disable
all escape sequences except for the single-quote (\') and
backslash (\\).

You may also create strings using %:

%(1 + 1 is #{1 + 1})#=> "1 + 1 is 2"

There are two different types of % strings
%q(...) behaves like a single-quote string (no interpolation
or character escaping), while %Q behaves as a double-quote
string. See Percent Strings below for more discussion of the syntax of
percent strings.

Adjacent string literals are automatically concatenated by the interpreter:

There is also a character literal notation to represent single character
strings, which syntax is a question mark (?) followed by a
single character or escape sequence that corresponds to a single codepoint
in the script encoding:

The indentation of the least-indented line will be removed from each line
of the content. Note that empty lines and lines consisting solely of
literal tabs and spaces will be ignored for the purposes of determining
indentation, but escaped tabs and spaces are considered non-indentation
characters.

A heredoc allows interpolation and escaped characters. You may disable
interpolation and escaping by surrounding the opening identifier with
single quotes: