Now let's talk about the consistent use of braces.
So here on my order processor I can check if an order is valid.
So let's write down if order processor dot is valid.
And I will simply submit the order object that I've created here.
And then I go to the next line of code.
And I simply want to create a Console.WriteLine and then say order is valid.
This is considered as a bad practice when it comes to clean code principles.
You know this works fine, right?
There's not a problem with it from a technical side of view, as we only have one code line here.
So one statement but still clean code says that we have to use braces even if we only have a single
statement.
So this is for sure working for if statements but also for loops for example.
So we can do the same here.
So for each for example.
And then we're going to say int I in.
Then we create a new int array here new int array.
Let's just add some examples here.
It's the same.
You don't want to add a Console.WriteLine and simply write down I for example know you want to wrap
it with braces every time, even if you only have a single statement for that, if statement for that,
for each loop for that while loop for that else block or whatever.
Right.
So that's the consistent use of braces.
Always use braces even if you only have a single statement.