** Strings are values for handling characters in programming. ** **
To generate a string, ** double quote the character ** Alternatively, enclose it in ** single quotes'**. See the example below.
[Example] Ruby file
"This is string."
'This is string, too.'
As you can see, strings are easy to generate.
Let's write a Ruby string in irb and execute it.
Terminal
#Start irb
% irb
irb
#Write a string and execute with the enter key
irb(main):001:0> "Hello!Hello!"
#If it continues to be displayed like this, it is successful
=> "Hello!Hello!"
** If double-byte spaces or Japanese are included, the program will generate an error, If you treat it as a string value, no error will occur. ** **
** A character string is a value for handling characters in programming. ** **
Recommended Posts