It is a memorandum for myself. It seems to look back when I forget it, and I plan to add it as needed.
If the types are not unified, an error will occur.
to_s method… Convert from integer type to string type Example) puts "Sam's age is" + 27.to_s + ""
to_i method… Convert from character string type to integer type) Example) puts 100 + "200" .to_i
puts "***".length(String length)
puts "***".reverse
puts "********".include?("***")(Is it included)
"#{variable}"
puts "#{name}Weight#{weight}kg"← Example
Variable expansion works only when enclosed in double quotes, When enclosed in single quotation marks, it is recognized as a character string rather than a variable.
Recommended Posts