0
Plz give me concepts about identation in 'if' statement
4 Respostas
+ 3
It's just a syntax
for example
In other programming languages the block of code would be enclosed with { }
ex:
if(condition){
IF BLOCK STATEMENTS
}
else{
ELSE BLOCK STATEMENTS
}
Instead of this block of code differentiation
python uses, colon and intendation
ex
if(condition):
IF BLOCK STATEMENTS
else:
ELSE BLOCK STATEMENTS
as u see the curly braces replaced with colon and indentation (4 spaces by default)
It would be convenient for developers to remember the exact block of code they are dealing just by looking rather than counting the { }
Especially in complex nested if statements
Hope u got my point.
+ 1
Definition of Indentation in English is a space before beginning of line or a paragraph.
In python 4 spaces are used for indentation in if function to differentiate from other line of codes.
0
4 spaces by default...thats the one i didnt understood.
0
It's for the differentiating blocks of code