Back to Freecodecamp

Dialogue 2: Adding Comments to Code

curriculum/challenges/english/blocks/learn-how-to-document-code-for-a-project/65e86cac39492642332416e9.md

latest3.0 KB
Original Source

--description--

Watch the video to understand the context of the upcoming lessons.

--assignment--

Watch the video

--scene--

json
{
  "setup": {
    "background": "company2-center.png",
    "characters": [
      {
        "character": "Sophie",
        "position": { "x": -25, "y": 0, "z": 1 }
      },
      {
        "character": "Brian",
        "position": { "x": 125, "y": 0, "z": 1 }
      }
    ],
    "audio": {
      "filename": "7.1-2.mp3",
      "startTime": 1
    },
    "alwaysShowDialogue": true
  },
  "commands": [
    {
      "character": "Sophie",
      "position": { "x": 25, "y": 0, "z": 1 },
      "startTime": 0
    },
    {
      "character": "Brian",
      "position": { "x": 70, "y": 0, "z": 1 },
      "startTime": 0.5
    },
    {
      "character": "Sophie",
      "startTime": 1,
      "finishTime": 4.82,
      "dialogue": {
        "text": "I'm working on this code and I think it's a good idea to add comments.",
        "align": "left"
      }
    },
    {
      "character": "Sophie",
      "startTime": 5.22,
      "finishTime": 6.9,
      "dialogue": {
        "text": "How should I write comments in the code?",
        "align": "left"
      }
    },
    {
      "character": "Brian",
      "startTime": 7.44,
      "finishTime": 12.36,
      "dialogue": {
        "text": "Great idea. To write comments, you simply need to use double slashes to start a comment.",
        "align": "right"
      }
    },
    {
      "character": "Brian",
      "startTime": 12.98,
      "finishTime": 17.56,
      "dialogue": {
        "text": "Then, you can describe what the code does so that other people can understand it, too.",
        "align": "right"
      }
    },
    {
      "character": "Sophie",
      "startTime": 18.36,
      "finishTime": 21.94,
      "dialogue": {
        "text": "And what should I comment on? Are there any specific things I should focus on?",
        "align": "left"
      }
    },
    {
      "character": "Brian",
      "startTime": 22.34,
      "finishTime": 26.24,
      "dialogue": {
        "text": "You should comment on any complex or tricky parts of your code.",
        "align": "right"
      }
    },
    {
      "character": "Brian",
      "startTime": 26.24,
      "finishTime": 30.92,
      "dialogue": {
        "text": "You can also explain what certain functions do and clarify the purpose of variables.",
        "align": "right"
      }
    },
    {
      "character": "Brian",
      "startTime": 31.36,
      "finishTime": 34.82,
      "dialogue": {
        "text": "Try to ensure that your comments are clear and concise.",
        "align": "right"
      }
    },
    {
      "character": "Sophie",
      "startTime": 35.66,
      "finishTime": 38.3,
      "dialogue": {
        "text": "I appreciate your help. I'll start adding comments to the code.",
        "align": "left"
      }
    },
    {
      "character": "Brian",
      "position": { "x": 125, "y": 0, "z": 1 },
      "startTime": 38.8
    },
    {
      "character": "Sophie",
      "position": { "x": -25, "y": 0, "z": 1 },
      "startTime": 39.3
    }
  ]
}