+ 2
Curly braces for of statements
The if statement on the continue page uses indentation instead of curly braces, is this an error or can C# interpret whitespace like Python?
2 Respostas
+ 18
// For C++ indentation is only for code to look pretty same for C#
but in Python it is used to describe what code of block belong to which statement...
remember C # compiler ignores white spaces
Curly braces is required for more than 1 statements
for only 1 statement it will not make any difference though it is not recommended...
for eg:-
1.) if (condition)
statement;
2.) if (condition) {
statement; }
The above two if's are same...
3.) if (condition)
statement 1;
statement 2; //this statement has nothing to do with if
statement 2 will execute, whether if is false or true
4.) if (condition) {
statement 1;
statement 2; }
in 4.) both statement depends on if
0
#csharp