If i wanted to add a while loop what would it look like? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If i wanted to add a while loop what would it look like?

https://code.sololearn.com/c5N8Hkf6kuk1/?ref=app

22nd Jul 2017, 2:26 AM
Whitehat
Whitehat - avatar
2 Answers
+ 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.
22nd Jul 2017, 3:01 AM
Rrestoring faith
Rrestoring faith - avatar
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; } } }
22nd Jul 2017, 11:02 AM
D_Stark
D_Stark - avatar