How to fix infinite loop when user enters char into int data type | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

How to fix infinite loop when user enters char into int data type

When we tell a user to enter a number, but instead they enter a character/string, the program will try and convert it into a number. When I try to loop it so the user can re-input the variable, infinite loop occurs. How do I fix this

17th Jun 2017, 1:00 PM
Shawn Kou
Shawn Kou - avatar
1 Respuesta
0
Implement a stop condition? Just allow 10 retries or stop if a valid number was entered
17th Jun 2017, 1:02 PM
Iqon