Louis I. answered 04/28/19
Computer Science Instructor/Tutor: Real World and Academia Experienced
Main reason for being a pseudo best-practice: consistency in appearance and easier to modify ... as very simple code blocks can get more complex over time - very easy to go
FROM
condition
{
line 1;
}
TO
condition
{
line 1;
line 2;
line 3;
}
without accidentally introducing a logical bug
condition // no braces
line 1;
line 2; // inadvertently omitted
line 3; // inadvertently omitted
I understand why the language allows it, but I almost wish the C/C++ compilers disallowed single-line code blocks with no { }