+ 1
Ruby output error
I am attempting to create a loop that takes in 2 integers from user, & results in a string answer depending on conditions. I am not sure where i am going wrong. I don't understand get.chomp very well either. My code works if i manually input the integers, but i need user input. What am I missing? https://code.sololearn.com/c1ynz5v2T7X5/?ref=app
2 Antworten
+ 2
Can you maybe put some comments in your code as to what you're expecting from each piece of logic and your reason behind using them?
That can help us question our own logic when we are writing out what we want in plain English.
+ 2
Your function doesn't need arguments. Replace line 1
def popsicle_ques(s, p)
with
def popsicle_ques()
and line 12
puts popsicle_ques(gets.chomp.to_i)
with
puts popsicle_ques()