How to: Comment code

View all subject updates

Why comments are important

Programs can include comments, which are ignored by the computer but are meant for humans to read. When you write code, it is helpful to add comments to let other people know what the code does or to remind yourself what it does when you’ve not looked at it in a while. In the mBlock language you can add a comment to any block by right clicking on it and clicking on ‘add comment’.

For example:

Subject Update How To Comment Code Figure 1

Comments are very important for sharing code, so that anyone reading, editing or debugging the original code in the future is able to understand the ideas and intent of the original author. In the real world, programmers work as part of teams. In teams, it’s important to share thoughts, ideas and processes quickly and easily.

activity age bookmark-fill icon bookmark boy-girl calendar chevron-down icon close icon compass cross icon download encounter-live facebook gallery icon instagram icon Instagram icon linkedin links icon location mail icon map next play previous professional-development right-arrow icon search share single image social-media speaker spinner icon students subject-update teacher-resources tick icon time twitter user video-lesson video youtube