Comments

Comments are lines in your code that will get ignored when compiling or running your code. When programming you may want to leave information for other people that may be looking at your code to describe pieces of it, that is what comments are for! This is the concept of comments and it is a really good habbit to get into especially when working in a group environment where you will infact have other people looking at and working with your code.

Every programming language can handle comments differently, however most of them will either use #, ;;, or // for their notation for what a comment is. Here are are a couple of examples of comments from some various languages:

  • Elisp:

    ;; This is a comment in elisp!
    
  • Python:

    # This is a comment in python!
    
  • Java:

    // This is a comment in Java!
    

Block Comments

Sometimes you may need to add multiple lines of comments in your program and although you could comment out every line most programming languages have support for block comments. Most programming languages that use the # or ;; syntax for their single line comments don't outright support block comments so unfortunately you may have to comment out each line however most languages that use the // syntax for their single line comments will use /* for the beginning of their block of comments and */ for the end of their comment block. Let's see some examples of this:

  • C:

    /*
    This is a multi line comment block in C!
    These are very useful when describing
    something that is more indepth than a
    single line comment will provide.
    */
    
  • Java:

    /*
    This is a multi line comment block in Java!
    You can see that it uses the same syntax
    as C.
    */
    
This page was last updated: 2023-04-12 Wed 20:25. Source