Just want to ask a simple question.
Because I tried to write the following code into single line,
- Before:
while True:
print('Hello world')
break
- After:
while True: print('Hello world') break
- Error message:
File "<ipython-input-19-cd7b3be1f22e>", line 1
while True: print('Hello world') break
^
SyntaxError: invalid syntax
- Have tried:
while True: print('Hello world')
break
- Error message again:
File "<ipython-input-20-0ecfc981712d>", line 2
break
^
IndentationError: unexpected indent
Is any idea to give "break" properly if I want to use it to stop while loop within single line?
Thanks in advance.