We'll come back in this lesson and continuing from our previous one we're going to talk about comments
I'm in the process I'm going to explain some important aspects of how a compiler works.
Let's go back to court in here.
This is the app that all the projects have been working on and it only has a one file called the main
that m.
It's a little bit different than the dot and that you have in Iowa is projects that is connected to
a dot h in here there's only one file and Devey that the wrong application works.
We pressed the bill then run it goes through this file line by line.
It goes from one line to another one to another one to another one it goes through the entire file and
compares this whole thing to understand what it should do.
That is essentially the role of a compiler not obviously obvious for earlier on about programming languages
you can't just type whatever you like in here.
It has to follow the rules of that particular programming language.
However you can add comments if you just want to write something that is a note for you or if it's not
for a colleague that you want them you want to pass on.
So the way you're doing it is putting two forward slashes and this is a Carmens.
Here you can write whatever you like.
You can make the spelling mistakes and you can write about your code or something you remember.
So for instance if I'm going along this code then I'm telling you that this and Aslaug is the code that
helps us print.
You can't just come in here and say this is the pre-install or if you want to you can just write here.
I didn't quite get it.
Let's review some parts I can type at some point.
So it essentially is a way for you to write your own comments in real life examples and once you have
a little bit more experience you obviously don't write this kind of comments you write comments for
colleagues or people who might be reading your code down.
That's right.
Or things that you know you know that you have to revert back to them at some point.
You might write something like that.
It is not working properly review that Dox or you might write something such as this is the main preens
method are reviewing it in what every class or something that makes sense to your colleagues.
But for now you can write your own you know comments in here throughout your code.
So when you go back to it it makes more sense for me however I'm going to remove everything that said
comments.
Obviously not that I should like and I'm going to remove all of these that line so I'm going to try
to keep the quote minimal so it's not overwhelming for you guys but for you if you want you can write
your own comments in here.
So one way of writing comment was using two forward slashes comments Carmens the two watts slashes and
there is another way if you want to write a longer piece of code and that is forward the slash the star
and then you close it with a star for the slash.
And here you can write multiple lines with many different things in them.
So it will be entirely ignored by the compiler.
So like I said when you press the bill down wrong the compiler goes in line by line by line but whenever
it finds this sign to forego other slashes it completely ignores that line whenever it finds this line.
It searches for the corresponding closing bracket and says let's ignore this entire piece and then move
on to the next line and that's how the compiler essentially goes through your code and tries to interpret
it.
So whenever you want to put comments you can just go in here and say Here I want to say something and
you can close it like this.
Of course for one line it doesn't really make sense that we use this method.
But if it was more than one line you could just add it like that and the compiler will know to ignore
this while we are here and this isn't really as important but they have noticed people asking me how
to show the line numbers.
You go to Mexico to preferences in the Preferences you go to text anything on the very first thing up
there is line numbers.
So they exclude preferences text anything line numbers it will show you the number of the lines.
Most usually you need to know the number of the lines but you know I kind of like to keep it in here.
So with that in mind now that we know how to add comments to our call let's move on to our next lesson.