Advertisement

This is going to be our first experience with something that's a little more like a concept...

But, it's really not that bad.  We'll just do a little at a time!

You can think of a function as being a box with a special rule... stuff goes in the box... and stuff comes out of the box.

Let's start with a movie title box:

THE RULE:  Spit out the first letter of the movie title. 
                           (Only movie titles can go in.)

input  ->  rule: spit out the first letter of the movie  ->  output

 

input: ALIEN  ->  rule: spit out the first letter of the movie  ->  output: A  ...  input: JAWS  ->  rule: spit out the first letter of the movie  ->  output: J