DEV Community

Tim Abell
Tim Abell

Posted on Originally published at timwise.co.uk on

Always add braces

Small matter of code style that I keep coming across.

Whether to write

if (thing) Action();
Enter fullscreen mode Exit fullscreen mode

or

if (thing)
{
    Action();
}
Enter fullscreen mode Exit fullscreen mode

We should always use the latter to avoid introducing bugs when modifying the code manually or through merge tools.

For the reasons behind this, read the following:

Top comments (0)