+ 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?

17th Feb 2018, 8:05 AM
QuakeMurphy
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
17th Feb 2018, 8:49 AM
🌛DT🌜
🌛DT🌜 - avatar
0
#csharp
19th Apr 2024, 12:41 PM
Alexander Rose
Alexander Rose - avatar