0

Why do we leave space to write if and else statement

Why can't we write it all under the same row

28th Apr 2020, 11:24 AM
Corporate Monster
Corporate Monster - avatar
2 Antworten
+ 3
You are talking about which language. You hadn't mentioned the language name. if you nesting two are more if statement in python then indentation is mandatory. but in other languages it dosen't required instead of that curly brackets are used {}
28th Apr 2020, 11:32 AM
Ayush Kumar
Ayush Kumar - avatar
0
It's the syntax of that programming language. The syntax is used to provide some kind of structure in the program for the compiler. But, in Java, you could write your entire program in a single line because the end of the line is indicated with a semicolon.
28th Apr 2020, 11:34 AM
rafalzacher1