Does it matter if the words are in upper or lower case? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Does it matter if the words are in upper or lower case?

if answer == "yes" elsif answer == "no" In codes like the ones above does it matter the case that I put the words in? For example, if I leave this code the way it is and the user inputs Yes istead of yes will the code still work?

29th Apr 2017, 9:54 PM
corgi
corgi - avatar
2 Answers
+ 4
You can try this: if answer.upcase == "YES" elsif answer.upcase == "NO" this way answer 'becomes' case insensitive
29th Apr 2017, 10:32 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar
0
Thank You
29th Apr 2017, 11:01 PM
corgi
corgi - avatar