Zebra0.com

javaUsing a do loop to force a valid response

Using a do loop to force a valid response

A common use of a do loop is to repeat an input until a valid response is entered. Here, the loop continues unit the user enters a valid month, a number from 1 to 12. When a valid month is enterd, the loop ends and the season is printed.