Move Blobbert | 3:20

Let's get coding! This segment of code will allow Blobbert to move around the game screen.

Continue reading below to review the concepts we discuss in the video and to check your final code!

Function:

A function is how we communicate with our game by creating a reusable list of steps for the computer to follow. Functions are similar to having something stored in your mind such as when your parents say “Make a PB&J”. They don’t need to tell you every single step, because you already have that knowledge stored in your mind and you can remember how to make a PB&J! 


Syntax:

The syntax is how the code is structured. Just like how we start with a capital letter and end with punctuation in English, code has a way it needs to be laid out! We call that structure its “syntax”.


Parameters:

Parameters are options given to a function that allow us to customize what the function does without having to rewrite the whole thing.


EEUT:

Enter, Enter, Up, Tab are a set of keystrokes we use when starting a new concept or phrase in coding. They allow our code to be laid out in an organized and neat manner in the "pyramid standard".

Here's the EEUT song (to the tune of Twinkle, Twinkle, Little Star):

Enter Enter Up Tab

That is how we make code fab

Enter Enter Up Tab

Make it so it won’t look drab

Enter Enter Up Tab

That’s the magic in the Blobbert camp.


If-Statements:

If-statements (also known as “if/then statements”) in coding are just like if-then statements in English. For example, in English I could say, "IF I eat five pounds of chocolate, THEN I get sick." Another way to put it is that if a condition is met ("If I eat five pounds of chocolate"), then a consequence occurs or is executed ("Then I get sick"). 

Code is the same way. If a certain condition is met, then a designated block of code will run. Let’s say we are programming a robot that can eat chocolate and can also get sick. We tell it "If you eat five pounds of chocolate, Then get sick." Once our robot's program detects that it ate five pounds of chocolate, the program will run the block of code "then get sick."


Keyword:

The keyword is the phrase that tells JavaScript what you are about to do, in the code we write on Line 2, the keyword is "if". This tells the computer that we need to run some string of logic to check a condition. 


Condition:

The condition is then notated directly after the keyword inside of a pair of parentheses, for example we could check "if (the sky is blue)". The condition is the “if” part of the if-then statement. 


Execution:

The execution is a block of code that is run if the condition provided is true. The execution is what the code DOES, or the “then” part of the if-then statement. A final example of keyword, condition, execution, could be: "if (the sky is blue) { go outside and play }


camelCase:

CamelCase is a standard way that we write words while coding. It is a naming convention used in JavaScript to make sure that all the function names are written similarly and predictably. The first word written is lowercase, and in all the following words the first letter is capitalized with no space between the words. The phrase is written without any spaces. 

Here are some examples:

typeOfBread

flavorOfJelly

chunkyOrSmooth





Screen Shot 2020-03-31 at 5.09.49 PM.png