+ 3

How can the compiler know where the while block is ending.In C we have { } which define the scope of the variable.

What about python?

4th Jan 2017, 2:05 AM
Piplup Xi
Piplup Xi - avatar
2 odpowiedzi
+ 3
In python we indent. a forever loop with while x=0 While x<10: print("part of the while statement") print("This wont get executed since not indented") x++
4th Jan 2017, 2:14 AM
Hello World!!!!
Hello World!!!! - avatar
+ 3
we use indentation to Indicate the beginning and end of any loop. Thus, the compiler will know where the while block is ending
9th Jun 2018, 5:44 AM
Aayushi
Aayushi - avatar