1 00:00:00,260 --> 00:00:05,260 One of the most important concepts in computer science is how to define new commands, how 2 00:00:05,260 --> 00:00:10,960 to add your own words to a computer language. Most computer languages have only about one 3 00:00:10,960 --> 00:00:17,289 hundred words or commands. The art and magic is in defining your own new words out of these 4 00:00:17,289 --> 00:00:23,210 building blocks. We do this all the time in sports. For example, in basketball, you start 5 00:00:23,210 --> 00:00:28,480 by learning how to dribble, how to do a lay-up, how to rebound. Once you've learned these 6 00:00:28,480 --> 00:00:33,010 really basic moves, you learn new moves and put together these building blocks, like a 7 00:00:33,010 --> 00:00:38,440 pick and roll or give and go. You can then go from there to do more complex plays. Once 8 00:00:38,440 --> 00:00:44,710 you learn that play and give it a name, everybody on the team knows how to do it. Similarly 9 00:00:44,710 --> 00:00:49,629 once you've taught a computer how to do an action once using these sequences of commands, 10 00:00:49,629 --> 00:00:55,159 you can make up your own name for that action so it's easy to repeat it later. When you 11 00:00:55,159 --> 00:01:00,679 define your own command and give it a name, that's called a function. Now we're going 12 00:01:00,679 --> 00:01:08,070 to use functions to help the bee. In this example, our function is called get 2 nectar, 13 00:01:08,070 --> 00:01:13,980 this green block right here. We know what get 2 nectar does by looking at this grey 14 00:01:13,980 --> 00:01:21,360 box which is the function definition. If we look inside there, the get 2 nectar is going 15 00:01:21,360 --> 00:01:28,230 to get nectar and then get nectar again. Always look at what's inside the grey box so that 16 00:01:28,230 --> 00:01:31,540 you know what these green function blocks can do.