0

What is identation block??

15th Sep 2018, 2:11 PM
Prince Verma
Prince Verma - avatar
2 Antworten
+ 2
Indentation block refers to the lines of code that have equal amount of empty space in the beginning. Usually 4 whitespaces. In python, this is used to group together multiple lines of code under a one common line of code. For example, a block of code that should be executed if a value is true should be indented compared to the if line. if this == True: do whatever do whateverelse print(“python is great”) In the python code above, the second and third lines are indented to indicate that they are part of the same block that is run only if the variable “this” is true. The last line is not indented and therefore is not part of the same block. Indentations are also used in loops and functions and it can be thought of as a way of determening the hierarchy of the code in python. Most other programming languages use brackets to determine this hierarchy.
15th Sep 2018, 3:14 PM
王達力
王達力 - avatar
+ 1
Full explanation here check this. https://www.python-course.eu/python3_blocks.php
15th Sep 2018, 4:09 PM
Maninder $ingh
Maninder $ingh - avatar