Features
This function is used to separate each code block. An error occurs if the indentation is not complied.
-
Indentation is used to separate each code block.
-
For Indentation, 2 spaces, 4 space or tab character can be used.
-
For a block, same type of indentation should be used
Example
Python
Code block 1
[TAB] Code block 2
Example)
if x == 3:
y += 1
# No Error
def fnSum(x,y):
[space4]sum = x + y
[space4]return sum
# No Error
def fnSubtract(x,y):
[TAB]diff = x - y
[TAB]return diff
# Indentation error
def fnProduct(x,y):
[space4]product = x * y
[TAB]return product