Break jumps out of the loop closest to it. such as while, for
Verify that the five letters you entered are uppercase.
Public Static voidMain (string[] args) {Console.WriteLine ("Please enter five uppercase letters:"); while(true) {//Loop until it is entered correctly BOOLA =true; stringstr =console.readline ();//The input defaults to a string. If the data is int, then Convert.ToInt32 (str); for(inti =0; I <5; i++) { if(Str[i] >='A'&& Str[i] <='Z') {//characters are stored as int data, character equivalent data//empty statement, no action}Else{a=false; Break;//Once there is a lowercase letter, jump out of the For Loop } } if(A = =true) {Console.WriteLine ("Enter the correct"); Break;//Jump out while loop}Else{Console.WriteLine ("have lowercase letters, input errors, please re-enter"); }} console.readkey (); }
Verify that the input meets the criteria