Comments

2 minutes
Share the link to this page
Copied
  Completed
In computer programming, a comment is a programmer-readable explanation or annotation in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand, and are generally ignored by compilers and interpreters.

Transcript

Hello, in this video, we are going to cover comments. And well, you've already seen a comment has been literally in all of the programming Python videos that I've done so far. This little thing, yeah, this will just dead by default, and it's online ID is a comment. So comment is something that isn't component run by the compiler, or the interpreter for that matter. So it's not run, and like, why would you want to use it. So it's great for providing some information about the code that's written there.

Because one, you might come back, you know, a year later, seven months later and not quite know what it does, especially when it's a complex algorithm. Or to you know, you might be on a team of developers and if they're looking at your code, you don't really want them to have to dry run, you know, on the lines of code in their head or on paper to figure out you know, sort of what does just have one or two lines of comments that say, you know, destroy this, this or this. This Your help a lot. And the other, you know, great benefit is if you got code, and you're trying to test it, what it's like without you with it. So deleting it, because you know, you don't have to delete it yet it's commented out. So if I put a line in my train, five, four, it's obviously print.

And if I put this line five, so these two lines on go together. The other cool thing is if I put a hash at the start of this one for now, so we basically it's called commenting out a line of code, and that just won't get run. So if we just wait for this to run, and see what we get, or you know, we get nothing successfully executed, but we literally got no result because this line was commented out if I put it back in. I'll be using comments throughout the videos. You know, Nuggets to help you especially with some of the more complex stuff. And it's working now.

So yeah, that's the wonderful world of comments from whichever language has some form of comments, they won't always have the same syntax, the format in terms of the usage will be very similar. And thanks for watching, and I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.