diff --git a/Coding-style.md b/Coding-style.md index a6479fd..9d4af84 100644 --- a/Coding-style.md +++ b/Coding-style.md @@ -48,6 +48,14 @@ if (x == 5) { } ``` * For and while cycles: basically same rules as for if condition. +* Try-catch blocks: again same rules as for if conditions. Closing parentheses of try block should be on the same line as catch block. +``` +try { + int a = 5 / 0; +} catch (exception ex) { + std::cout << "Division by zero" << std::endl; +} +``` * Switch: again basics are the same as for if condition. Case statements should not be indented and case body should be intended with 1 tab. ``` switch (switched) {