Return to Video

Frozen - Hour of Code Introduction to Functions

  • 0:00 - 0:03
    One of the most important concepts of computer science,
  • 0:03 - 0:07
    is how to define new commands;
    how to add your own words to the computer language.
  • 0:09 - 0:13
    Most computer languages have only about a hundred words or commands
  • 0:13 - 0:18
    and the art is to define your own new words out of these coding blocks.
  • 0:18 - 0:20
    We do this all the time at sports.
  • 0:22 - 0:27
    In basketball you learn how to dribble, how to do a lay-up and how to rebound.
  • 0:27 - 0:31
    Once you've learned these moves,
    you learn new moves
  • 0:31 - 0:35
    and put together these building blocks,
    like a pick and roll or give and go
  • 0:35 - 0:38
    and from there you can do more complex plays.
  • 0:38 - 0:43
    Once you learned that play and give it a name,
    everybody on the team knows how to do it.
  • 0:43 - 0:47
    Simulary, once you learned a computer how to do an action once,
  • 0:47 - 0:49
    using these sequence of commands,
  • 0:49 - 0:54
    you can make up your own name for that action,
    so it's easier to repeat it later.
  • 0:54 - 0:58
    When you define your own command and give it a name,
    it's called a function.
  • 1:00 - 1:01
    If you are programming with blocks,
  • 1:01 - 1:05
    you can use functions if there is a set of actions
    which you are gonna use a lot of times.
  • 1:05 - 1:09
    For example, you've written code to create a square,
  • 1:09 - 1:13
    You could define this as a function called "create a square".
  • 1:13 - 1:19
    Now you have a new block
    that you can use multiple times to create multiple squares.
  • 1:20 - 1:23
    A lot of simple functions can be used,
    to create more complex patterns.
  • 1:24 - 1:26
    In the next puzzle,
  • 1:26 - 1:28
    the code you recently wrote to make a circle
  • 1:28 - 1:32
    is available to you as a new function
    that can make circles of different sizes.
  • 1:32 - 1:36
    Can you use it to help Elsa to create a new beautiful pattern in the snow?
Title:
Frozen - Hour of Code Introduction to Functions
Description:

more » « less
Video Language:
English
Duration:
01:38

English subtitles

Incomplete

Revisions