Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

invalid syntax python else

Python does not allow empty blocks, unlike many other languages 
(since it doesn't use braces to indicate a block).
The pass keyword must be used any time you want to have an empty block 
(including in if/else statements and methods).

For example:
if 3 > 0:
    print('3 greater then 0')
else:
    pass
    
Or an empty method:

def doNothing():
    pass
 
PREVIOUS NEXT
Tagged: #invalid #syntax #python
ADD COMMENT
Topic
Name
7+9 =