Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 4: Controlling Memory with Variables

Similar presentations


Presentation on theme: "Lesson 4: Controlling Memory with Variables"— Presentation transcript:

1 Lesson 4: Controlling Memory with Variables
UNIT 5 – LESSON 4

2 WHEN YOU COMPLETE LESSON 4, TURN IN THE PAPER WHERE YOU MADE YOUR PREDICTIONS AND COMPUTATIONS FOR CREDIT. When you finish Lesson 4, you will go on to Lesson 5

3 VOCABULARY Data Type - All values in a programming language have a "type" - such as a Number, Boolean, or String - that dictates how the computer will interpret it. For example 7+5 is interpreted differently from "7"+"5" Expression - Any valid unit of code that resolves to a value. Variable - A placeholder for a piece of information that can change.

4

5 PURPOSE: Developing a good mental model for how variables work in computer programs is absolutely essential to long-term success as a programmer.

6 PROGRAMMING IS NOT MATH
The = sign in programming is an instruction to store a value in memory, NOT a statement of equality. “Variables” in computer programming are just named pieces of memory, NOT unknowns in an equation or symbols for undetermined values.

7 Recall patterns in making event-driven apps.
Add UI elements to the screen. Give the UI elements meaningful IDs. Add event handlers to those elements.

8  App Lab already keeps track of a lot of things for you in memory without you doing anything, like the position and styling of elements on the screen, especially if they are moving around. But you will want to write programs that keep track of data that’s not “built-into” the programming environment. These apps use and control the computer’s memory to do this, and learning how to use memory in programs is a powerful skill to have. Today we’ll start!

9 The programming tasks in this lesson acquaint you with basics of working with variables and building up a mental model for how programs use and manage memory. To keep things simple, the output will mostly be simple text displayed to the app screen or debug console. In the next lesson we’ll apply what you learn to an app for a simple game.

10 WATCH: Tutorial - Introduction to Variables Part 1 - Video (download) Tutorial - Introduction to Variables Part 2 - Video (download)

11 To get credit for Unit 5, Lesson 4, Complete the entire lesson and Turn in the paper you worked stuff out on. Then go on to Unit 5, Lesson 5


Download ppt "Lesson 4: Controlling Memory with Variables"

Similar presentations


Ads by Google