+ 1

Is there a way to control the lines

I've learned CPP before python and in "if statement " of "while" or whatever I knew exactly how much lines in the body I have because I put them between brackets like " if(1) { doSomething(); cout<<something(); cin>>x;} " But in python I'm confused "If 1:"how many of the next lines it will have I can control them in CPP how about python?

13th Jun 2019, 2:52 PM
Abdullaa Taha
Abdullaa Taha - avatar
4 odpowiedzi
+ 3
if(#something is true): print("this is in the statement") print("this too") print("this not")
13th Jun 2019, 2:57 PM
Cat Sauce
Cat Sauce - avatar
+ 2
The body of the ( if statement ) is indicated by the indentation. Body starts with an indentation and the first unindented line marks the end.
13th Jun 2019, 3:41 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
+ 1
Thank you
13th Jun 2019, 3:00 PM
Abdullaa Taha
Abdullaa Taha - avatar
+ 1
I think it is not available in Python, but you can replace it by arranging statements in parallel. as Cat Sauce shown.
16th Jun 2019, 7:51 AM
‎صافي العراقي‎