string_number = "42"
integer_number = string_number.to_i
float_number = string_number.to_f

puts integer_number  # خروجی: 42
puts float_number    # خروجی: 42.0