+ 3

Can i nest while loops in java or python?

14th May 2018, 12:54 PM
yonatan
8 odpowiedzi
+ 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.
14th May 2018, 1:06 PM
DAB
DAB - avatar
+ 5
while 1>0: while 2>0: print("Blah") Don't do this, btw. It's just for explananion.
14th May 2018, 1:00 PM
DAB
DAB - avatar
+ 2
You can do. while condition: while condition: while condition: and with also for loops.
14th May 2018, 3:57 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
how do I do that?
14th May 2018, 12:56 PM
yonatan
+ 1
of course. so I can also add if statements inside them?
14th May 2018, 1:01 PM
yonatan
+ 1
wow thanks man
14th May 2018, 1:09 PM
yonatan
+ 1
thanks
14th May 2018, 3:57 PM
yonatan
0
yes, u can do it in java
15th May 2018, 6:37 AM
Bunny