Due a few minutes ago.
Lots of late adds, so we will allow submissions for a few more days; get it done if you have not done it yet.
Build your own, original Scratch program!
Available on CS 105 Website
Due: Tomorrow, Feb. 3, 8:00pm
Statements instruct the computer to DO something.
moveForward(10);
moveForward(10);
console.log("Anything you want");
Variables allow a program to REMEMBER a value for later use.
The first time you use a variable, you must tell the computer about it by using var:
var temp = 20;
After the computer knows about it, you should never use var again for that variable:
var temp = 20; temp = temp + 10; // Adding 10 to temp temp = temp - 10; // Subtracting 10 from temp temp = temp * 2; // Multiplying temp by 2 temp = temp / 2; // Dividing temp by 2
Conditionals CONTROL the path of execution.
if ( ____________ ) {
}
var temp = 20;
if ( temp < 32 ) {
console.log("Burrr!");
}
var temp = 20;
if ( temp < 32 ) {
console.log("Burrr!");
} else {
console.log("Warmth!!");
}
Lets print some variables!
var birthMonth = you.birthMonth; var birthDay = you.birthYear;
var birthMonth = 11; // Yours will probably be different var birthDay = 27; // Yours will probably be different
if (birthMonth < 4) { moveToRightSideOfRoom(); }
else if (birthMonth > 9) { moveToLeftSideOfRoom(); }
else { moveToCenterOfRoom(); }
if (birthMonth < 4) { moveToRightSideOfRoom(); }
else if (birthMonth > 9) { moveToLeftSideOfRoom(); }
else { moveToCenterOfRoom(); }
while ( running == "yes" ) {
var otherPerson = findAnotherPerson();
if (you.birthMonth < otherPerson.birthMonth) {
you.moveForward();
} else if (you.birthMonth > otherPerson.birthMonth) {
you.moveBackwards();
} else {
if (you.birthDay < otherPerson.birthDay) {
you.moveForward();
} else {
you.moveBackwards();
}
}
}
We'll begin using them on Wednesday!
We will randomly give +1 points throughout the semester for answering questions.
(At least +5 by end of semester.)