** A method that a string has. It converts a character string to a number. ** ** By the way, the meaning of i in to_i is "integer". See the example below.
[Example] irb
#To the string "30"_Execute with i method
irb(main):001:0> "30".to_i
=> 30
If it is a non-numeric string, it will be converted to the number 0.
Let's try the to_i method.
irb
# to_Convert a string to a number with i
irb(main):001:0> "100".to_i + 400
=> 500
** The to_i method is a method that converts a character string into a number. ** **
Recommended Posts