+ 3
Can i nest while loops in java or python?
8 ответов
+ 7
Yes, of course. You can nest conditionals inside loops, loops inside conditionals, loops inside loops or conditionals inside conditionals.
Here, conditionals == if statements.
Try out the coding challenges in lesson factory. You'll find plenty of cases where nested loops/conditional statements are used. Even if you don't do them, at least study the codes in the comments.
+ 5
while 1>0:
while 2>0:
print("Blah")
Don't do this, btw. It's just for explananion.
+ 2
You can do.
while condition:
while condition:
while condition:
and with also for loops.
+ 1
how do I do that?
+ 1
of course. so I can also add if statements inside them?
+ 1
wow thanks man
+ 1
thanks
0
yes, u can do it in java