CRE Programming Club - Class 2 Robert Eckstein and Robert Heard.

Slides:



Advertisements
Similar presentations
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Advertisements

 Variables  What are they?  Declaring and initializing variables  Common uses for variables  Variables you get “for free” in Processing ▪ Aka: Built-in.
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Written by: Dr. JJ Shepherd
Solving Linear Equations
Those Dynamic Fractions
Week 9: Methods 1.  We have written lots of code so far  It has all been inside of the main() method  What about a big program?  The main() method.
Week 2: Primitive Data Types 1.  Programming in Java  Everything goes inside a class  The main() method is the starting point for executing instructions.
Mr Barton’s Maths Notes
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.
Introduction to Primitives. Overview Today we will discuss: –The eight primitive types, especially int and double –Declaring the types of variables –Operations.
COMP 4—Power Tools for the Mind1 PowerTools What’s in the Box? Turing 1: An Introduction to Programming You will learn elementary computer programming.
Intro to Robots Robots are Everywhere. Intro to Robots Various robots in use today lawnmower pet baby seal for convalescents gutter cleaner home security.
Introduction to a Programming Environment
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Dividing Polynomials.
“But I don't want to be a “programmer!” ActionScript for journalists Presentation by Mindy McAdams Flashjournalism.com.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
Multiplication and Division Addition and Subtraction PracticeExponentsParenthesesHomeQuizIntroduction Objective and Standards Please Excuse My Dear Aunt.
A quadratic equation is a second degree polynomial, usually written in general form: The a, b, and c terms are called the coefficients of the equation,
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
In.  This presentation will only make sense if you view it in presentation mode (hit F5). If you don’t do that there will be multiple slides that are.
Week 2 - Monday.  What did we talk about last time?  Software development  Lab 1.
Bill's Amazing Content Rotator jQuery Content Rotator.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
Welcome to the How to Talk to Animals, The Complete System: Advanced Topics Home Study Course Bonus Class.
Fall Week 3 CSCI-141 Scott C. Johnson.  Say we want to draw the following figure ◦ How would we go about doing this?
Week 5 - Wednesday.  What did we talk about last time?  Exam 1!  And before that?  Review!  And before that?  if and switch statements.
 Make sure you are subscribed to announcements on Moodle.  Activity 4 will be due 48hrs after your lab ends.
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
Collecting Things Together - Lists 1. We’ve seen that Python can store things in memory and retrieve, using names. Sometime we want to store a bunch of.
Welcome to the CRE Programming Club! Robert Eckstein and Robert Heard.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #001 (January 17, 2015)
Lecture 5 1.What is a variable 2.What types of information are stored in a variable 3.Getting user input from the keyboard 1.
1 Advanced Computer Programming Lab Calculator Project.
CRE Programming Club Class 3 (Install Small Basic on the new computers! Double-click on I:/smallbasic.msi)
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
Sight Words.
CRE Programming Club Class 8 Robert Eckstein and Robert Heard.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Lesson 1. Security At the menu bar at the top you will see the word Tools. Click your mouse on Tools scroll down to Macro. Move the Mouse over and down.
BIT 115: Introduction To Programming Professor: Dr. Baba Kofi Weusijana (say Doc-tor Way-oo-see-jah-nah, Doc-tor, or Bah-bah)
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Written by: Dr. JJ Shepherd
CRE Programming Club Class 2 (Import JJZ543 and Practice Your Typing!)
GCSE Computing: Programming GCSE Programming Remembering Python.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
CIS 338: VB Variables Dr. Ralph D. Westfall April, 2011.
CSS IS A LANGUAGE DESIGNED TO TARGET HTML ELEMENTS AND NODES BY TYPE, CLASS, ID AND VALUE, AND CHANGE THEIR VALUES CSS – change how your HTML looks and.
CRE Programming Club - Class 3 Robert Eckstein and Robert Heard.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #003 (February 14, 2015)
2.1 First C Program. First Program Open visual studio, click new file Save as “programName.c” – Program must start with letter and have no spaces – Must.
Week 2 - Wednesday CS 121.
what is computer programming?
Introduction to Computer Science / Procedural – 67130
IF statements.
Variables and Primative Types
Variables, Expressions, and IO
Lesson 2: Building Blocks of Programming
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
Number and String Operations
Introduction to TouchDevelop
Overloading functions
Presentation transcript:

CRE Programming Club - Class 2 Robert Eckstein and Robert Heard

What Are Variables Again? Variables vary (change), and constants are constantly the same. In the world of programming, there are values in your program that need to change all the time, and there are values that will stay the same. For the most part in Small Basic, you’ll be using variables.

Variables How do we create a variable in Small Basic? Well, we just give it a name and set it equal to something. Most variables names are short words or single letters. A = 20 This is kind of like getting a box, writing “A” on the outside, and putting the number 20 inside of it. If you come along later and say, “Hey, I’d like to use what’s in A, you’re going to get 20.” At this point in the program, A = 20.

Variables Let’s test that out by adding the following line afterwards: TextWindow.WriteLine(“A is “ + A) This command will write out the current value of A. What happens if we put the following after it? A = 21 TextWindow.WriteLine(“A is “ + A)

What Can a Variable Store? So what can a variable store? Well, with Small Basic, one of two things. We already know it can store a number. For those of you working with fractions and decimals, variables can store any number, including those with decimals. So, 40 and a half would be written as 40.5.

Variables Can Also Store Words! Hmmm… how do computers handle words? Well, kind of like what you did as a baby with building blocks. Remember that computers are dumb and they really, really love codes. Turns out the computer has a code number for each letter, a code number for a space, a code number for a questions mark, and, well… a code number for pretty much everything on your keyboard.

What Can a Variable Store? When it wants to use words, it just strings the letters and symbols together like the building blocks of a baby. And, when it’s done, it adds on a special code (usually 0) that says, “Okay, this is the end of the it!” So, we know about numbers, but what are these words or sets of words or symbols or whatever called?

Strings Must Have Quotes! Let’s write a string and assign it to a variable. A = “Hello There!” Note that a string is always surrounded by double quotes. What happens if we write? A = Hello Small Basic will think we want to take the value in the variable Hello and copy it into A.

Try Some of These... A = “Hello There” A = A = * 4 A = B A = A + 1 A = (B * C) / D A = Math.PI A = Math.PI * R * R A = currentArea - 1 A = “Hello “ + “There” A = “12” + “34” A = “Hello “ + 12 Set the other variables (B, C, D, currentArea) to something if you need to! Can you set Math.PI to something?

Adding Strings and Numbers What happens if we add two numbers together? What happens if we add a number to a String? Experiment and see what happens! A = “Hello” A = A + “ There ” A = A + 12

Point of Execution This tells the exact point where the program is executing. A program will execute line by line. When it finishes one line (a statement), it moves onto the next. And the next. And the next. And it keeps going, unless you tell it to go somewhere else in the program. So if I tell it later that A = 21, then 20 gets thrown away, and A now equals 21.

No Confusion So, the important thing to remember here is: a program won’t do what it’s told to do UNTIL IT GETS to that line, and when it gets done executing that line, THE COMPUTER HAS DONE IT.

Computers are Dumb Like they said in the video last week, deep down computers are pretty dumb. But they’re actually a little like football quarterbacks. Have you ever seen a football quarterback come up to the line and say something like “43! 21!”. Each of those numbers is a secret code that means something to the other players.

Computers are Dumb Computers are the same way. They get a number like 43, and that tells them do so something. And then they get a number like 21, and that’s a code too. And they know what to do with that number too! Each code number means something, and it never changes. This is called machine language.

Next Time.... Keep experimenting with variables between this class and the next! Try things at home! Next time, we’re going to learn some more about how computers work and some of the branching functionality that is available.