Q. Which method is used to convert a string to integer in Ruby?

  • (A) to_int
  • (B) to_i
  • (C) int()
  • (D) convert_to_int
πŸ’¬ Discuss
βœ… Correct Answer: (B) to_i
Explanation: The 'to_i' method converts a string to an integer in Ruby.
Explanation by: Rati Dubey
The 'to_i' method converts a string to an integer in Ruby.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
112
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Rati Dubey
Publisher
πŸ“ˆ
99%
Success Rate