June 2019
Beginner to intermediate
660 pages
14h 30m
English
Strings are objects that represent a stream or sequence of characters. In Ruby, we can assign a string value to a variable with ease, as seen in the previous example. By merely defining the value in quotation marks or a single quotation mark, we can assign a value to a string.
It is recommended to use double quotation marks because if single quotations are used, it can create problems. Let's have a look at the problems that may arise:
irb(main):005:0> name = 'Msf Book' => "Msf Book" irb(main):006:0> name = 'Msf's Book' irb(main):007:0' '
We can see that when we used a single quotation mark, it worked. However, when we tried to put Msf's instead of the value Msf, an error occurred. This is because it read the single quotation ...
Read now
Unlock full access