0

Why in if statements, the code inside the block should be indented?

I mean, what is indented mean here in a block?

22nd Oct 2020, 10:29 AM
Sadab Askir
Sadab Askir - avatar
4 Answers
+ 2
For Example: In C++ Language we use if statement with curly bracket (open & close) code: if (a>2) { cout<<"c is greater"<<endl; } In python: if a>2: print("c is greater", c) > in phyton intended means the border of the if statement > in c++ language the curly bracket used for the border of the if statement
22nd Oct 2020, 10:54 AM
Naimat Ullah
Naimat Ullah - avatar
+ 1
Then how will you identify which part of the code is inside *if* statment and which is not.
22nd Oct 2020, 10:35 AM
Arsenic
Arsenic - avatar
+ 1
A code block belonging to a statement, such as if/else, needs to be: enclosed in quotes in parentheses indented
20th Jan 2023, 7:01 PM
Satya prakash pal
0
A code block belonging to a statement, such as if/else, needs to be: indented
22nd Mar 2023, 5:06 PM
Vlad Tylman
Vlad Tylman - avatar