Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004.

Slides:



Advertisements
Similar presentations
Variables Conditionals Boolean Expressions Conditional Statements How a program produces different results based on varying circumstances if, else if,
Advertisements

11-3: Subtracting Integers
Types and Arithmetic Operators
Introduction to Computing Concepts Note Set 7. Overview Variables Data Types Basic Arithmetic Expressions ▫ Arithmetic.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Changing Control.
10-Jun-15 Introduction to Primitives. 2 Overview Today we will discuss: The eight primitive types, especially int and double Declaring the types of variables.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Introduction to Primitives. Overview Today we will discuss: –The eight primitive types, especially int and double –Declaring the types of variables –Operations.
VB DATATYPES, VARIABLES, CONSTANTS & CALCULATIONS.
110-D1 Variables, Constants and Calculations(1) Chapter 3: we are familiar with VB IDE (building a form…) to make our applications more powerful, we need.
Agenda Review Compiling Review Data Types Integer Division Composition C++ Mathematical Functions User Input Reading: , 8.11 Homework #3.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004.
National Diploma Unit 4 Introduction to Software Development Data types, variables and constants.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Copyright 1999 by Larry Fuhrer. Pascal Programming Getting Started...
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004.
Arithmetic Operations. Review function statement input/output comment #include data type variable identifier constant declaration.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Assignment 6.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
Pointers: Basics. 2 What is a pointer? First of all, it is a variable, just like other variables you studied  So it has type, storage etc. Difference:
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
Primitive Data Types. Identifiers What word does it sound like?
1 homework Due today: hw #1 (mailing list printout) readings to date: chapter 1 and chapter read appendix B (3 pages on DOS) and and.
Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off.
Lesson Two: Everything You Need to Know
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 More details and explanation …
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Drawing pictures … It’s not art, it’s fun.
Variables and Constants Objectives F To understand Identifiers, Variables, and Constants.
4. EXPRESSIONS. Display the value of pi, to 5 decimal places, right justified, in 9 columns Read in someone’s height in feet and inches using.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Functional Abstraction Reduces Complexity.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Computing Is Pretty Strange.
Test Review. General Info. All tests will be comprehensive. You will be tested more on your understanding of code as opposed to your ability to write.
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
What will each of the following lines print? System.out.println("number" ); number645 System.out.println("number" + (6 + 4)+ 5); number105 System.out.println(6.
Topic 02: Introduction to ActionScript 3.0
User Interaction and Variables
Programming constructs
Variables, Expressions, and IO
Introduction to JavaScript
Time Manager Class Activity Material Manager Writer leader Communicator Programmer Start a journey from the capital AbuDhabi to Alasmaa School using your.
Variables & Datatypes CSE 120 Winter 2018
To do … Web Exercise: Quiz-3, HW#2 Score: update
A second look at JavaScript
Variables & Datatypes CSE 120 Spring 2017
Numbers.
Announcements Mid-Term Exam!! Quiz 5 Again + Quiz 6 Exercise 5
Art Programs Raise Deep Questions
Announcements How’s it going? My internet/power supply?
Testing and Repetition
Variables Kevin Harville.
Chapter # 2 Part 2 Programs And data
Using the Power of XML Personally
ICT Gaming Lesson 3.
Variables & Datatypes CSE 120 Winter 2019
Variables, Assignments Testing + Iteration
Introduction to JavaScript
Introduction to Primitives
Lawrence Snyder University of Washington, Seattle
Introduction to Primitives
Primitive Types and Expressions
Chapter 4, Variables Brief Notes
Javascript Chapter 19 and 20 5/3/2019.
Announcements How to save your work? Quiz solution 5/5/2019
Announcements: Questions: Names on the board? Why?
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Data Types and Maths Programming Guides.
Lawrence Snyder University of Washington
Announcements Survey feedback: summary Quiz: HW 7:
Python Creating a calculator.
Presentation transcript:

Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004

 We have three basic ideas to cover –  Datatypes  Declarations  Variables  They all interact … we’ll just start on these ideas today 10/2/2016© Larry Snyder2

10/2/2016© Larry Snyder3

 variables are names used in a program for quantities that vary … get it? Variables vary!  So, one thing we can do is give them values:  x = 12; //Give x the value 12 x is the variable, and it’s being assigned the value 12  Now, whenever I use the variable x, as in  y = x + 1; //Increase the value of y it is as if I had used its value (12) directly: y=12+1  It’s pretty obvious … but there’s more to it 10/2/2016© Larry Snyder4 Caution: variables are NOT unknowns

 The data that variables name has certain properties … we group information with similar properties into “types” --  integers, or whole numbers  floating point, usually called decimal numbers, have decimal points  colors, a triple of numbers for R, G and B  Etc. 10/2/2016© Larry Snyder5

 Processing has a series of datatypes  The most important datatypes for us are int, float, boolean and color … we add more later  Find details in the references 10/2/2016© Larry Snyder6

 Processing (and all languages) need to know the types of data you are working with  We tell them the type by declaring a variable’s datatype  When declaring variables we list them after the type, as in  int x, y, z;  float half_step = 0.5, whole = 1.0;  color yellow = color(200,200,0); 10/2/2016© Larry Snyder7

 Variables are case sensitive int leftSide, left_side, leftside; // declare 3 vars  Variables can be initialized float temperature = 98.6;// declare & initialize  Variables names are meaningless to computers, but meaningful to people … don’t lie color myWhite = color(0,0,0); //White … ha, ha!  Variables are declared at top of a program 10/2/2016© Larry Snyder8

 Raphael gets a var  Adding a variable value of 0 to each horizontal position results in no change; same as before 10/2/2016© Larry Snyder9

 When ra has the value of 200, Raff’s position is changed 10/2/2016© Larry Snyder 10 Just Do It!

 The functions setup( ) and draw( ) allow the Processing computations to be dynamic  Recall that they work as follows:  Make Raphael run! 10/2/2016© Larry Snyder11 setup( ) draw( )

10/2/2016© Larry Snyder12 Just Do It!

 Start Raff off-screen to right, by initializing him to … ?  Then make him move left by … ?  And speed his movement up by … ? 10/2/2016© Larry Snyder13 Just Do It!

 Note 400 is enough to hide him off screen  Subtracting moves him left  Changing ra by 2 speeds him up 10/2/2016© Larry Snyder14

 Today, we learned about  variables … names for quantities that vary in the program  datatypes … forms of data like integers, floating point numbers (decimal numbers), colors, booleans, etc.  declarations … statements that define what datatype variables are, as in int ra = 0;  And we learned the min( ) function 10/2/2016© Larry Snyder15