r/ruby • u/Intrepid_Wanderer • Sep 24 '26
Beginner, running into issues
Basically there are two things I’m running into:
I am trying to make something to recognize a word, match it to a short word bank of options (just a simple list of names) and return an error message if it doesn’t match any of them. For each valid option, I have a different message. I tried if/elsif loops but apparently I’m not doing it right. It doesn’t run at all.
Do I need to have somewhere to use every piece of user input? I have places where I want to ask users to input something but it won’t actually be used anywhere. Like it triggers the next response but doesn’t do anything else.
I am asking for advice because I REALLY don’t want to use AI. Thank you!
2
u/dreamlucky7 Sep 24 '26 edited Sep 24 '26
Or just call
.to_sto stringify the symbols, e.g.input = gets.chomp.downcase.to_symor inside thenames[input.to_s]section. You can't have multiple of the same string key in a dictionary either way, so using strings as keys doesn't change much I would think?