Hello and welcome to this lecture.
In this lecture be showing you how to use comments with your ruby code command comments can be useful
for a variety of reasons they can be used to explain your code.
Comments are also ignored when the code executes or runs.
Comments can be used for trouble shooting and testing.
Key is for testing and also for troubleshooting.
There are two types of comments you've got a single line comment and also a mauti line comment to illustrate
how comments are used.
I got my text open so I'm just going to first force feed this far as it would be far too far.
As I now see it inside my documents are a core and it's comments
to dot are we have already got a fire call comments I just made his comments to be a big C so I'm just
going to write some commands here first to be going to be put them for 7.
I am going to do a puts together and when I say hello world or something.
Well.
Ah right.
I'm going to do.
I'm just going to copy this code and pasted down here just to save some time and change some techs here.
Just say thanks for watching.
K. And I changed it to 7 for it.
All right so how do you use a single line comment.
There are several ways you can use a comet.
You can put a comment that's just the top before the code so if there for example I wanted to explain
something about this code I'll use a single line comment.
The symbol is that just a hash tag voicing a line comment and then I can write the comment.
I can see hoods
introduces or put in place if a single
line carry.
Return.
Output.
So what this is saying basically when you run this command to our fate has put this number to also leave
a space underneath basically what is so loose.
A comment this way it does actually interfere with the code everything the commands will still work.
However if you decide to place a comment in front of the actual command like so then that means this
command will not run when the code executes.
Okay I'll do the because when the code execute comments are ignored.
So if you persist in their comments you don't want the code that affected your players to comment.
But for the record like I've done here.
So if I want to switch let's put this copy this a few times.
Maybe there's more to Paul lying comments.
Put another one there.
Okay.
So if I wanted if I had several lines of code and wanted to comment everything from that line.
So rather than use a single line only Twan I can multiple comment then I just took a course to and you
type in biggie.
You have to see when it begins and you have to also tell it when it ends and the do equals it.
It is very important he is it begin and end.
So if I execute this code the only thing I expect to be outputted on the screen is this one is 7 for
7 and businesses.
Hello world.
This will be ignored and this free line of code also be ignored so let me say that and let me run to
run that I need to open up my command prompt.
I am going to use guitar bass command line which is this and I am going to type in the name of off so
to read the far and I'm just going to change territory to where I sit.
I saved it in mind documents folder and the name of the cards calls comments too.
So I'm going to use Ruby to interact thus far by calling the name.
I see Ruby followed by the name on the far comments to dot RB and the press enter.
You can see this.
You can see the code.
Now if I open up my text editor I just want to minimize that so you can see which parts of the code
was executed and which part didn't execute.
So you can see the puts 747 that one executed.
He can see the Heller was executed.
The other three dozen lists lie.
One two three.
And this did not because they all being commented out.
So that's basically how you use comments in Ruby it's going to be very important as you get more acquainted
with the Ruby language you're going to be using to use comments a lot.
So that's it.
Thanks for watching.
Bye for now.