Ask coding questions

← Back to all posts
setting return value and getting input...

Hey, so I'm having a couple of problems with my code. They should be fairly easy to fix- I've just not been able to figure them out.

  1. So I have to set my return value on ConvertToInt(stringScore) to -1 if it's any negative number. I'm not sure how to do this. Currently it just returns whatever intScore equals.

  2. When my code calls ConvertToInt(), I want it to continue to get input from the user if it's unable to convert to an integer.
    Same with when my code calls ValidateInput(). If it isn't valid, how do I continue to get input from the user instead of just going through with the non-valid information?

Thank you! :)