What is 'indentation' in simple language? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is 'indentation' in simple language?

7th Jan 2019, 7:11 PM
Ashutosh Dash
Ashutosh Dash - avatar
3 Answers
+ 3
Languages such as Python dont use the typical { } system. Instead the rely on a consistant amount of indentation. if 1 == 1: print("") else: print("") Notice the consistant indent inside of the if/else statements are spaced 4 to the right. That is the indentation. Until recently, I thought you had to have 4 spaces. Thanks to a mod on sololearn, I now know that it doesn't have to be 4, it just has to be consistantly the same amount.
7th Jan 2019, 7:38 PM
LordHill
LordHill - avatar
7th Jan 2019, 7:18 PM
Diego
Diego - avatar
+ 1
Indentations can be spaces or tabs, which seems to be an ongoing arguement in the programming world. Python requires indentation for blocks of code, but languages like c++ and java do not. However, it is recommened to use indentations for blocks of code for readability & neatness of code.
7th Jan 2019, 8:17 PM
25tunez
25tunez - avatar