Vidyalelo
Ruby Programming · Q44

Basic Syntax in Ruby

Programming · Ruby Programming · question 44

Q44

What is the correct way to cast a string to an integer in Ruby?

A.
string.to_i
Answer
B.
string.integer
C.
int(string)
D.
string.convert(:integer)

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board