360,181 views
39 votes
39 votes
What would the following code do?
while True :
print("Hello")

User Slattery
by
2.3k points

2 Answers

28 votes
28 votes
Answer: Will just keep printing “Hello”

Explanation: when you pass a value to a whole loop let’s say it’s called “var1” if u just submit the variable to the whole loop like ‘while var1’ it will run the code in the block while var1 is true '!while var1' for the opposite, so when you pass 'while True' it will keep running the code while True is equal to True which it always will
User Vanje
by
2.5k points
12 votes
12 votes

Answer:

If it is true then it will write hello

User Mhartl
by
2.4k points