Each time you type : at the end of the line, Python expects a statement or expression indented in the next block.
To create an "empty" loop, use pass:
def function():
if mode == 1:
pass
# code will go here
elif mode == 2:
pass
# code will go here
else:
pass
# code will go here
while True:
while True:
pass
# code here
the error occurs at the first "While True" loop
The reason it happens, is because after the else: Python is expecting a statement or an expression, and since the first one of those is the while True:, and its not indented to be under the else: block you get that exception.
#codecomments, when replaced with code, would need to be indented with respect to the precedingif,elif, orelse. If they are lined up with them, as they are now, then the bodies are empty and it's a syntax error.:afterdef function.#code- at leastpasscommand.if/elif/else/while/forcan't have empty blocks - comments are not treated as correct blocks.SyntaxError: invalid syntaxthen. So I think it's just a copy-paste issue.