Abstraction with Functions

You might have gotten very good at remembering how to solve a maze, and which pattern of Move Tank is Forward, and which is Back, and which is Left or Right.

But you might have seen it gets quite hard to solve larger more complex problems, if you have to remember and keep track of so many details.

Charades

In a game of charades you have to abstract an entire concept into some basic idea that will make your partner understand what complex thing you are trying to convey without explaining the entire thing.

Let's Play!

Abstraction in Coding

You can use Abstraction to simplify things and hide some details:

Abstracting Statements

Which is easier to read?

So, how do we create these abstractions?

Create Functions

1. Get a Function Block

2. Give Function the abstract Name

3. Move your complex Code Block into Function Definition

4. Find the newly created Function Block under Functions

5. Move the new Function Block into the correct place in your code

Challenge