break out of a while loop : break « Statement « Python Tutorial






while True: 
    word = raw_input('Please enter a word: ')
    if not word: break 
    print 'The word was ' + word








3.5.break
3.5.1.Breaking Out of Loops
3.5.2.break out of a while loop
3.5.3.Use break to stop execution and break out of the current loop
3.5.4.break and continue Statements, and Else Clauses on Loops