Beginning to Program Variables, Etc' - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Beginning to Program Variables, Etc'

Description:

Names we give to storage locations in RAM. Length. Variables ... INPUT: to store a value in RAM and give its location a name so it can be used later. ... – PowerPoint PPT presentation

Number of Views:86
Avg rating:3.0/5.0
Slides: 26
Provided by: reneec4
Category:

less

Transcript and Presenter's Notes

Title: Beginning to Program Variables, Etc'


1
Beginning to ProgramVariables, Etc.
  • Computer Programming 1-2

2
Variables
Names we give to storage locations in RAM.
3
Variables
Names we give to storage locations in RAM.
Length
4
Variables
Names we give to storage locations in RAM.
Length Width
5
Variables
Names we give to storage locations in RAM.
Length Width Area
6
Variable names
  • Must begin with a letter
  • Should be descriptive and meaningful
  • May not contain spaces or special characters

7
Valid or Invalid??
8
Assignment Statements
  • Use LET to give a variable a value.

LET variable ___
9
LET Statement Examples
  • LET Age 17
  • LET Age 6.5
  • LET Cost 4.99
  • LET TaxRate .07125
  • LET NegNumber -4

No or commas!
10
Use LET Statements for
  • INPUT to store a value in RAM and give its
    location a name so it can be used later.
  • PROCESSING calculations

11
Computer Calculations
12
Computer Calculations
13
Computer Calculations
14
Computer Calculations
15
Write these expressions in Basic
  • 4x 5y 3 4 x 5 y 3
  • 6c
  • 7r 5
  • a2b2

16
Write these expressions in Basic
  • 4x 5y 3 4 x 5 y 3
  • 6c 6 c
  • 7r 5 7 r 5
  • a2b2 a 2 b 2
  • a a b b

17
Evaluate these expressions
  • 1 2 3
  • 5 (4 3) / 2
  • 1 (2 3) 2 - 1

18
LET Statement Examples
  • LET Total a b
  • LET Half Num / 2
  • LET GrossPay Hours Rate

Variable on left formula on right
19
Hey! Not all data is numeric.
20
What about words and names?
21
Think of some data that is not numeric
  • Words
  • Names
  • What else??

22
Non-numeric data are called strings.
String variables end with
23
LET Statement Examples
Variable ends with string in
  • LET Word Hi
  • LET Name Sue
  • Let Title War and Peace

24
What else do we need? We can...
  • Use LET for Input
  • Use LET for Processing
  • Use PRINT for Output

25
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com