Back to Freecodecamp

Dialogue 3: Getting Help with Variables

curriculum/challenges/english/blocks/learn-how-to-use-code-related-concepts-and-terms/66334fd916a3a697e1d2c631.md

latest3.2 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": "Tom",
        "position": { "x": -25, "y": 0, "z": 1 }
      },
      {
        "character": "Sophie",
        "position": { "x": 125, "y": 0, "z": 1 }
      }
    ],
    "audio": {
      "filename": "5.2-3.mp3",
      "startTime": 1
    },
    "alwaysShowDialogue": true
  },
  "commands": [
    {
      "character": "Tom",
      "position": { "x": 25, "y": 0, "z": 1 },
      "startTime": 0
    },
    {
      "character": "Sophie",
      "position": { "x": 70, "y": 0, "z": 1 },
      "startTime": 0.5
    },
    {
      "character": "Tom",
      "startTime": 1,
      "finishTime": 7.14,
      "dialogue": {
        "text": "Hey, Sophie. I'm working on a project that uses many variables. I'm not sure how to manage them all.",
        "align": "left"
      }
    },
    {
      "character": "Sophie",
      "startTime": 7.88,
      "finishTime": 12.18,
      "dialogue": {
        "text": "Variables help you store information in your code, like names, numbers, and more.",
        "align": "right"
      }
    },
    {
      "character": "Sophie",
      "startTime": 12.6,
      "finishTime": 15.32,
      "dialogue": {
        "text": "You can use the equals symbol to assign values to them.",
        "align": "right"
      }
    },
    {
      "character": "Tom",
      "startTime": 15.7,
      "finishTime": 19.78,
      "dialogue": {
        "text": "Thanks, Sophie. I'm also using many constants in my project.",
        "align": "left"
      }
    },
    {
      "character": "Tom",
      "startTime": 20.2,
      "finishTime": 22.76,
      "dialogue": {
        "text": "But what's the difference between variables and constants?",
        "align": "left"
      }
    },
    {
      "character": "Sophie",
      "startTime": 23.24,
      "finishTime": 28.02,
      "dialogue": {
        "text": "Great question, Tom. Variables can change their values, but constants stay the same.",
        "align": "right"
      }
    },
    {
      "character": "Sophie",
      "startTime": 28.02,
      "finishTime": 31.14,
      "dialogue": {
        "text": "Think of variables as containers that you can fill and empty,",
        "align": "right"
      }
    },
    {
      "character": "Sophie",
      "startTime": 31.14,
      "finishTime": 34.62,
      "dialogue": {
        "text": "and constants as locked boxes that keep the same contents.",
        "align": "right"
      }
    },
    {
      "character": "Tom",
      "startTime": 35.44,
      "finishTime": 38.98,
      "dialogue": {
        "text": "I see. So that means I can change the values in these variables,",
        "align": "left"
      }
    },
    {
      "character": "Tom",
      "startTime": 39.12,
      "finishTime": 41.62,
      "dialogue": {
        "text": "but I can't touch the values in these constants.",
        "align": "left"
      }
    },
    {
      "character": "Sophie",
      "position": { "x": 125, "y": 0, "z": 1 },
      "startTime": 42.12
    },
    {
      "character": "Tom",
      "position": { "x": -25, "y": 0, "z": 1 },
      "startTime": 42.62
    }
  ]
}