Comments
Variables
Loops
Statements I
100

How do you make a comment?

by putting // in the beginning

ex: 

//this is a comment

100

How do you make a variable?

you put var in the front of your statement.

100

How do you make a loop that goes on forever?

you start with the word while.

100

how do you make the hero move right?

hero.moveRight();

200

Why do we use comments?

So that we/other people looking at our code understands what it does

200

What do variables do?

They store information so that you can use later on.

200

what do while loops do?

basically they go on until the condition you put inside of it is false. basically looks like...

ex: the condition is age < 10. while loops go on until age is no longer < 10.

var age = 0;

while(age < 10){

age+=1;

}

console.log(age);

// should print out 10

200

how do you make the hero attack Greg?

hero.attack("Greg");

300

Which of the following are comments?

a) if(age > 10){eat food}

b)//this code is for moving the hero character up

c) this code is for moving the hero down

b. Because it has the // in the front
300

Which one is a variable?

a) //var v = 0;

b) var v = "hello";

c) if(time > 0){console.log('hello')}

b. because it starts with var. a would be a variable if it didnt have // in front but with // its not a comment.

300

Which one is a loop?

a) while(true){console.log("hi")}

b) if(true){console.log("hey")}

c) //loop

a is a loop.

300

Make the hero attack the nearest Enemy.

var enemy = hero.findNearestEnemy();

hero.attack(enemy);

400

There are 2 different ways to write comments. // is for single line comments and we have another way to write multi line comments. How do you do that?

ex: fill in the __.

// comment1

//comment2

__comment1

comment2__

/* to be in front of comment 1 and */ to be after comment 2

400

Create your own variable and set it equal to whatever you want

3 parts to a variable.

1) var in the beginning

2) create a unique name

3) set it equal to something (optional)

Ex: var cookie = 1;

400

Create your own while loop.

ex: while(true){

console.log("hi")

}

400

Make the hero move up, left, down, right indefinitely.

while(true){

hero.moveUp();

hero.moveLeft();

hero.moveDown();

hero.moveRight();

}

500

What is the difference between // and /**/

// is for single line commenting

/**/ is for multiline commenting

500

Create a variable called cookie and set it equal to 0.

var cookie = 0;

500

create a while loop that will make the hero move left then right indefinitely. 

while(true){

hero.moveLeft();

hero.moveRight();

}
500

Create a variable called steps and set it equal to 1.

Then create a while loop that goes on forever and will make the hero walk up steps amount of time.

var steps = 1;

while(true){

hero.moveUp(steps)

}

M
e
n
u