Next freebie in 28 Hours*
// one line comment
Or if you have a lot more to say (multiple lines in a comment,) you can achieve that with ease by putting “/*” at the start and “*/” at the end like this:
/* This function requires two parameters: a string and a boolean.
It then returns a boolean that indicates if the user has a fat butt or not.
Call it like this for example: gotFatButt(userName, isFat); */
Comments can be used to achieve discipline in coding. First you can comment out any code which you don’t want to run. If you delete your code there's always a chance you’ll regret it later when suddenly you figure out it's just what you need. Instead of deleting, just comment out blocks of code you think you might need again. (It's almost guaranteed that if you delete a block, you WILL need it later!)
Comments are a great way to describe your code and leave behind extra information for you and others that work with your code. A good program needs a good strategy and many times a few comments can help and improve overall understanding of your code. Comments are used as documentation many times in code as a way to share with others and yourself insight about your code. Many times we comment out debugging functions or other lines of code that we still want available but don't want them to run.
These tips may make your life easier in the future.
Have a question but don't want to ask it publicly? If you are a prime member just ask right here and we will get back to you within 48 hours. Not prime yet? no worries you can ask publicly below.