If there is only one statement, then there is no difference in using "block" and "writing inline".
Braces are used only to enclose a sequence of statements that are intended to be seen as a single process.
General syntax for if
:
if ( condition_in_the_diamond )
statement_to_execute_if_condition_is_true;
So to make multiple lines of code as a single process, we use braces.
Hence if you have only one statement to execute in if statement, the it would be similar.
Using braces are better because it reduces the chances of error. Suppose you are commenting a line of code in hurry to debug:
if(condition)
// statement1;
statement2; //this will bring statement2 in if clause which was not intended
or while adding a line of code:
if(condition)
statement1;
statement3; // won't be included in if
statement2;
But if you are using inline statement as:
if(condition) statement1;
then it might prevent you from above error but it will make statement1
of limited length (assuming 80 character width code). That will make it sweet and simple to read though.
Hence unless you are using inline statement, using braces is suggested.
Source