I have a variable assigned to user input. I want to check if the user input is an integer. how do I do that?
a = gets
I have a variable assigned to user input. I want to check if the user input is an integer. how do I do that?
a = gets
There is no need to check: gets
returns a String
, so a
will never reference an Integer
, it will always be a String
. There is no possible way that a
will ever reference an Integer
in the code you posted.