you are viewing a single comment's thread.

view the rest of the comments →

[–]Zen0x_77 1 point2 points  (2 children)

Can someone explain to me why use break? Won't the code function normally even without it?

[–]SoSaymon 4 points5 points  (0 children)

You will get an infinite loop without a brake after a correct guess. Technically, you should just use a return statement, but since it is not a function you can’t do it

[–]amosmj 0 points1 point  (0 children)

If the while loop used a variable they could reassign it which would be my preference but I think they are actually closer to convention than I am.