0

What is this indention?

What's the difference of it in C++/C and python

5th Sep 2016, 6:33 PM
Rishabh Nishad
Rishabh Nishad - avatar
3 Answers
+ 1
Indention in c++/c is used for readability only. In Python indention is analog of curly braces in c++/c. But, there are some differences. For example, you must use indention in Python to mark operators bodies (like while, for, if), when in c++ you can skip curly braces if it is one-statement body. You also can not indent in random place in Python, but in c++/c you can put statements in blocks freely.
6th Sep 2016, 6:22 AM
Textobot
Textobot - avatar
+ 1
https://i.stack.imgur.com/YPjNm.png HOPE YOU FIND IT HELPFUL :D
7th Sep 2016, 4:19 PM
yancy
yancy - avatar
0
Indention is typing a blank space at the beginning of a line. This is necessary to make the python compiler understand that whatever follows the blank space, is a statement to be executed if the conditions for the if coming before are satisfied. In C-like languages, { } are used to open and close the statements instead. In C and other similar languages, indention is used as well, but is not necessary for the execution. It is only used in order to make the code easier to read.
10th Sep 2016, 10:07 PM
Giulnever Fergett
Giulnever Fergett - avatar