Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 20 Online
OpenStudy (anonymous):

MIT OCW 6.00SC PS 1-C question What doe the line "while True:" mean? Specifically, I'm confused by the "True". Thanks!

OpenStudy (anonymous):

Do you understand what "while a=b" means? You can interpret this in the same way

OpenStudy (anonymous):

True and False = Boolean algebra so the while loop will run will something is True.

OpenStudy (anonymous):

It is an infinite loop. It will continue until it reaches a "break;"

OpenStudy (e.mccormick):

Sort of like the meanest exercise/drill instructor you ever heard of. "Do situps until I tell you to stop!" and he never says stop. As some of the others have hinted, while is a type of loop. As long as what is evaluated is true, the loop keeps going. Here is some related psudocode: a=5 b=5 while( a equals b) do this loop This would keep looping. But it can be made shorter: while( true ) do this loop

OpenStudy (anonymous):

while is a kind of loop to iterate/execute a block of statement which follows the starting and ending statements of while loop. while true is half of it. it says that uptil when an expression is proving to be true loop it.

OpenStudy (anonymous):

for an example say. x = 1 and y = 10. we want to make x = y. then we would say. while x < y, x = x+1, loop

OpenStudy (e.mccormick):

@shobhitkv The example they are talking about is an infinite loop. It has no proper exit condition like what you are describing.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!