+ 3

I have found a bug in the Playground in Ruby.

This error is present both on the web interface and in the mobile application on Android. It is an example of the bug in a small program with my detailed comments: https://code.sololearn.com/cuVs0fN1sf8m I do not know how to report it to the developers.

3rd Mar 2018, 11:15 PM
meloman K_Y
meloman K_Y - avatar
6 odpowiedzi
+ 11
@Dennis and @Mickel pointed out that there is not a bug. But next time if you do find one, you can email Sololearn at info@sololearn.com or tell them via the feedback option 😊
4th Mar 2018, 3:23 AM
Learnsolo
+ 5
There is no bug, gets includes a newline. +\n is not equal to + so of course the switch won't work. Use gets.chomp to drop said newline and it works fine.
3rd Mar 2018, 11:32 PM
Dennis
Dennis - avatar
+ 5
Dennis is right. In any case, there is another thing you should know. Your case statements work because they are not equivalent to an if statement case myBar when 1 some code when 2 some code It is equivalent to: # if var == value is different from if var === value if myBar === 1 some code elsif myBar === 2 some code end Here you have more information: https://blog.arkency.com/the-equals-equals-equals-case-equality-operator-in-ruby/
3rd Mar 2018, 11:43 PM
Mickel
Mickel - avatar
+ 4
Tap on the three dots on the top right of the screen, tap feedback, change it to bugs, and send it.
3rd Mar 2018, 11:27 PM
Jax
Jax - avatar
+ 2
Thanks for all! The gets.chomp method works fine.
3rd Mar 2018, 11:46 PM
meloman K_Y
meloman K_Y - avatar
+ 1
The issue is that there is a trailing newline character when getting user input. Use the strip function to remove the trailing white space.
3rd Mar 2018, 11:36 PM
Jesse Bayliss
Jesse Bayliss - avatar