- :-

Topics Covered

  • Commenting
  • Lesson Links

    Check Your Understanding:
    1. 1. Code that appears after a " // " mark is:
    2. Given priority over other lines of code and will run first
      Ignored by the compiler and not sent to the robot
      Ignored by the compiler but sent to the robot
      Accelerated and will execute twice as fast
    3. 2. Which of the following lines is correctly marked as a comment?
    4. ** comment
      /* comment */
      */ comment /*
      THIS IS A COMMENT: COMMENT
    5. 3. Comments are used to:
    6. Leave notes to human programmers
      Quickly disable certain parts of the code to assist in troubleshooting
      Make a program run faster
      Both first and second answers are correct, but not the third.
    Try It!
    Try it! 1

    Multi-line Comments

    Use a multiple line comment above your code to write out in detail what your program is actively trying to do.

    Create a header for your programs with your name, class, date, and other information that will identify your program. With comments, you can use almost any keyboard characters to personalize your header. Use this header in all of your program you write moving forward.

    Try it!

    Commenting - Mini Challenges

    Mini Challenge 1: Code Exchange

    Create a simple program with the robot. For example, move around a chair, move and pick something up, etc. The program is to be written with NO comments. The purpose of the challenge is to show how the addition of comments make a program much easier to read and understand.

    After coming up with the program, save the program and hand it off to another student to try to figure out the intended program.
    • Depending on the user's program, materials for this challenge will vary. Have all possible variations of the challenge table prepared.

    Mini Challenge PDF[ Code Exchange.pdf ]

    Mini Challenge 2: Time Capsule

    Do the same thing as the "Code Exchange" challenge - Write a program that includes NO comments - but save the code as TimeCapsule.c and don’t touch it for two weeks.

    Come back after those two weeks, open your program, and try to remember what it was supposed to do. Did you remember?
    • Depending on the user's program, materials for this challenge will vary. Have all possible variations of the challenge table prepared.

    Mini Challenge PDF[ Time Capsule.pdf ]