puts "Please, try again. You cannot use zero!"
Here's the situation. The 'arr' is an array converted from a string (and we get that string from user input). This code is checking if there's a zero in the 'arr', but it acts really weird. If the user inputs something like '123q', this message will be printed, even though there's no zero. Of course, if the input is '1230', it works just fine. I couldn't find any information about that, but i've spent a fairly good amount of time researching.
There's more to that.
Another piece of code, but closely related to my question.
puts "Please, try again. You cannot use non-numerical characters!"
In this case, if user input is '1230', this message will still be printed.
The question is: What's really going on there and how do i fix it? I need this code to check only for zero.
Ruby .include? method seems to think that 0 represents also all non-numerical characters and doesn't really represent itself. Is 0 non-numerical? How do i make it a number again so my 'if' would work the way i expect it to?
P.S. I'm using repl.it (current Ruby version 2.3.1p112) to run the code and there was no monkey-patching or anything like that.