< Return to Video

Course 4 - Artist: Variables

  • 0:04 - 0:10
    A variable is a container you can store a
    value in. When you use that variable in an
  • 0:10 - 0:16
    algorithm, it opens up the container and looks
    at the value inside. This lets you write smarter
  • 0:16 - 0:22
    algorithms that behave differently depending
    on the value stored in the variable. For example,
  • 0:22 - 0:27
    if you wanted to write an algorithm to say
    Happy birthday, you're turning 10! to my little
  • 0:27 - 0:33
    brother, that's great now but when I run it
    next year I'd want it to say, Happy birthday,
  • 0:33 - 0:39
    you're turning 11! I could create a variable
    called age to store my brother's age and write
  • 0:39 - 0:45
    my algorithm to say Happy birthday, you're
    turning 'age' instead. Because variable can
  • 0:45 - 0:53
    change, every year I can update the variable
    'age' to equal 'age' plus 1. In this puzzle,
  • 0:53 - 0:57
    we're going to be using a variable that will
    set the length of the line our artist draws.
  • 0:57 - 1:03
    Later on in our code, the move forward block
    will look at that length variable to see what
  • 1:03 - 1:04
    value you've set it to.
Title:
Course 4 - Artist: Variables
Video Language:
English
Team:
Code.org
Project:
CSF '21-'22
Duration:
01:07

English subtitles

Revisions