Make a Note of It

Every once in a while a note of explanation to another code user or to yourself is helpful. Comments or notes are used by coders to leave instructions, reminders, and information inside their code – for themselves or for those who might also use their work. This is done in BlocklyProp with the note block.


Did You Know?

Comments are notes about your code that help explain to other people what your code is doing. Also, it is good to leave comments as notes to yourself about what you were doing in case you need a reminder days (or months or years) later. The process of leaving notes or comments in your code is referred to as "documenting your code".

You can help make your code self-documenting by picking variable and constant names that help make the program more self-explanatory. In a visual program language like Blockly, code often explains itself.

Why might you leave a note in your code?

  1. To name, date, leave authorship information or track changes - this is done in the program description with BlocklyProp.
  2. Other people may need or want  to understand what the code does.
  3. Documented code can save you time trying to remember what your code does,  and how it does it, after you haven’t looked at it in a long time.

Know that coders have differing ideas about comments - some prefer very few comments or even none at all, others prefer thorough documentation.

Remember that with BlocklyProp the code visually explains, so less is more!


 

Adding Comments

This is the add comment block. It is found in the CONTROL category:

In addition, blank separator can be chosen from the dropdown menu on the block:

This image shows the dropdown menu on the add comment block.

The blank separator option turns the block into a blank white block.  Just like adding a comment, using a blank separator has no effect on your program.  You can use it to create visual separation between parts of your program.  The block can be changed back to an add comment block by clicking on the triangle and selecting comment.

In the example below, the coder named his program, recorded the date it was written, and listed himself as the author.

The purpose of such a comment might be so that this info could be recorded in a screen captured image of the code. Use comments in your BlocklyProp programs when they serve a specific purpose for you or for someone else. Otherwise, they can clutter your code and be more confusing than helpful.

Note: The add comment/blank separator block has no effect in your code. You can place them anywhere within your program that you need to make a note and it will not change your program's behavior in any way.

  • Give it try - especially if it helps you or others.

Special thanks to Parallax friend Whit Stodghill for his assistance in writing, editing, and testing material for these S3 tutorials.