-: Now where comments can rarely help
and often hurt our code,
code formatting is another thing which is really helpful,
when it comes to improving the readability
and understandability of our code.
Because code formatting improves readability
and helps us transport meaning across our code.
And we can differentiate
between two kinds of code formatting,
vertical formatting and horizontal formatting.
Vertical formatting
simply refers to any formatting any code structuring we do
from the top to the bottom of our file.
So vertically.
That includes spacing between lines and grouping of code.
And I will show you concrete examples in just a second.
Horizontal formatting on the other end
is everything which happens within one line of code.
So horizontally.
And that involves indentation,
space between code in one line of code,
and of course in general the width of our code lines.
Now when it comes to formatting and formatting properly,
it is of course true that formatting is important
and helps us with code readability,
but only if it's done properly.
And here we'll not just have some general rules
and concepts which I will show you over the next lectures,
but we'll also have language specific formatting rules.
Where most of the concepts shown in this course
apply across all languages.
We also have formatting rules
which differ between different programming languages.
And is always the general conventions
and style guides of these languages,
which you wanna follow when it comes to formatting.
So for example, if you think about indentation
something I will come back to in a second,
and you will think about whether you wanna indent by
two spaces or four spaces, or by using taps.
Then it's always also the language guidelines
and style guides which you will typically find,
which answered the question on how to indent properly.
So you never wanna forget about these.
Nonetheless, there also are some general rules
and concepts, which always apply.
And these are the rules and concepts,
we're now going to have a closer look at.
So let's now take a closer look
at these two kinds of formatting's
and let's understand which kind of rules
we should follow there.