+ 1

Can anyone correct me why i'm only getting the output : No You are wrong

ans = gets puts "[1]WHAT IS THE CAPITAL OF INDIA?" if ans = "Mumbai" puts "No,You are wrong!" elsif ans = "Telangana" puts "Neh! Try one more time" elsif ans = "Delhi" puts "Yes! You are right!!!!" end

12th Apr 2020, 6:46 AM
Aaditya Damani
2 ответов
+ 1
to test equality in ruby use == rather than = which is for assignment if ans == "Mumbai" ... https://www.sololearn.com/learn/Ruby/2766/
12th Apr 2020, 7:05 AM
John Robotane
John Robotane - avatar
0
Assignment --> '=' Comparison -->'=='
12th Apr 2020, 7:51 AM
Justus
Justus - avatar