0
If i wanted to add a while loop what would it look like?
2 odpowiedzi
+ 2
while(conditionIsTrue){
// Do this
}
You never really specified what you wanted it to do, so idk what it's supposed to look like. Sorry. (Please make sure the questions are clear)
You can make it how you want it to look with the syntax above.
0
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner x = new Scanner(System.in);
String y = x.nextLine();
int z = 10;
switch(y.toLowerCase()){
case "hello":
while(z >0){
System.out.println("hello");--z;}
break;
}
}
}