# CS Principles

## Unit 3 - Algorithms and Programming

### Lesson 4: Using Simple Commands

• ``` moveForward ```
• ``` turnLeft ```
• ``` penUp ```
• ``` penDown ```

### Lesson 5: Creating Functions

• ``` function myFunction() { // function body, including optional "return" command. } ```
• ``` Call a function ```

### Lesson 7: APIs and Using Functions with Parameters

• ``` moveTo ```
• ``` turnTo ```
• ``` arcRight ```
• ``` arcLeft ```
• ``` penWidth ```
• ``` penColor ```
• ``` penRGB ```
• ``` Call a function with parameters ```

### Lesson 8: Creating Functions with Parameters

• ``` randomNumber min/max ```
• ``` function myFunction(n){ //code } ```
• ``` Call a function with parameters ```

## Unit 5 - Building Apps

### Lesson 1: Introduction to Event-Driven Programming

• ``` onEvent(id, type, function(event)){ ... } ```
• ``` setPosition(id, x, y, width, height) ```
• ``` setSize(id, width, height) ```

### Lesson 2: Multi-Screen Apps

• ``` setScreen(screenId) ```
• ``` console.log ```

### Lesson 4: Controlling Memory with Variables

• ``` write(text) ```
• ``` value1 + value2; ```
• ``` num1 - num2; ```
• ``` num1 * num2; ```
• ``` num1 / num2; ```
• ``` randomNumber ```
• ``` var x = __; ```
• ``` x = __; ```
• ``` var x = promptNum("Enter a value"); ```
• ``` var x = "__"; ```

### Lesson 5: Building an App: Clicker Game

• ``` setText(id, text) ```
• ``` if( ){ //code } ```
• ``` __ == __ ```

### Lesson 6: User Input and Strings

• ``` getText(id) ```
• ``` var x = prompt("Enter a value"); ```
• ``` str.toUpperCase ```
• ``` str.toLowerCase ```

### Lesson 8: Boolean Expressions and "if" Statements

• ``` if( ){ //code } ```
• ``` if ( ){ // if code } else { // else code } ```
• ``` __ == __ ```
• ``` __ != __ ```
• ``` __ > __ ```
• ``` __ >= __ ```
• ``` __ < __ ```
• ``` __ <= __ ```

### Lesson 9: "if-else-if" and Conditional Logic

• ``` if ( ){ // if code } else { // else code } ```
• ``` __ && __ ```
• ``` __ || __ ```
• ``` !__ ```

### Lesson 10: Building an App: Color Sleuth

• ``` setProperty(id, property, value) ```
• ``` rgb(r, g, b, a) ```

### Lesson 11: While Loops

• ``` while( ){ // code } ```

### Lesson 13: Introduction to Arrays

• ``` list.length ```
• ``` insertItem(list, index, item) ```
• ``` var list = ["a","b","d"]; ```
• ``` var x = [1,2,3,4]; ```
• ``` appendItem(list, item) ```
• ``` removeItem(list, index) ```

### Lesson 14: Building an App: Image Scroller

• ``` onEvent(id, type, function(event)){ ... } ```
• ``` setImageURL(id, url); ```
• ``` playSound(url) ```

### Lesson 15: Processing Arrays

• ``` for(var i=0; i<4; i++){ //code } ```
• ``` function myFunction(n){ //code } ```

### Lesson 16: Functions with Return Values

• ``` return ```

### Lesson 17: Building an App: Canvas Painter

• ``` setActiveCanvas ```
• ``` line ```
• ``` circle ```
• ``` setStrokeColor ```
• ``` setFillColor ```
• ``` clearCanvas ```