1 vote

Understanding infinite loop with while loop

while() will run as long as the condition inside is true. In your code, an integer >2 will make it an infinite loop because the condition will be forever true. Alternatively, if you use if() ...
user avatar
  • 26

Only top scored, non community-wiki answers of a minimum length are eligible