Personally, I always write statements that I can use curly braces with curly braces . For example, take the code:
if (UserIsLoggedIn())
ShowCreditCardDetails();
Now, if some amateur coder comes in and wants to do something else when the user is logged in:
if (UserIsLoggedIn())
WriteAuditLog();
ShowCreditCardDetails();
It ShowCreditCardDetails()will now be launched for users who are not logged in, because only the first statement after ifis executed when there are no curly braces. If it were:
if (UserIsLoggedIn())
{
ShowCreditCardDetails();
}
, .
, , if. . - .