Tab Content
Tab Title
Instructions
Tab Content
  1. Find comments in the code by looking for text in gray.
     
  2. Read the text in the comments.

 

STEM Connections

Comments are for the benefit of computer programmers (the humans) and do not affect the code. Comments are helpful for making notes in complex codes. Comments not only help you as a programmer who is writing those codes, but they also help others who may use your code in the future. Comments change to gray when written with the correct syntax.

Tab Title
Implementation
Tab Content

At the Thinkabit Lab, we explain to students the value of including comments in the code they write through presenting the following concepts:

  1. The comments are just for humans and do not affect the code.
    • Ask: “Why would you want to comment on your code?" 
    • Answer: Comments remind the programmer (you) and team members what the code was supposed to do and explain in words what the code is doing.
  2. Most jobs require programmers to comment on their code.
    • Ask: “Why would this be a requirement?"
    • Answer: At tech companies, coders typically work in teams. Therefore, it is necessary to write comments so your teammates know how and where to insert their code.
  3. Engineers depend on the comments in the code to work as a team.
    • Ask: “How many lines of code are in a smartphone?"
    • Answer: 25-65 million lines of code in contrast to less than 10 lines in the blink code.
    • Ask: “How long would it take one person to write all the code for a smartphone by themselves, without any help?"
    • Answer: Over 2000 years (calculated by 25 working lines of code a day).
  4. Comments are a way to communicate with team members.    
    • Ask: “Which classes have you had where you’ve learned how to work in teams and/or helped you with communication?"
    • Answer: Language arts (English) often help us learn to speak and communicate well. We can also develop those skills in debate classes, through social studies and science presentations. When we work on projects with classmates in any class or play on teams, we can develop teamwork skills.
    • Answer: The ability to communicate with words effectively requires concepts that are learned in language arts.
  5. There are 2 ways to write comments:
    • Line form: Writing “//” allows you to write a single line of comments
    • Paragraph form: Writing “/*” allows you to start writing in paragraphs (as everything below this starting symbol turns into comments) until it sees the end “*/”

 

If you are using the Thinkabit Lab Notebook:
 

Explain to students that they will be writing their own comments in their notebooks on page 14 to help them understand how the code controls the LED.

Instruction Category
Video