Vtech PreComputer Power Pad Plus User Manual - Page 43

Constants

Page 43 highlights

VARIABLE NAMES CONTENTS A 675 B 2.3434 C$ CURTIS A$ ALPHABET SOUP Here's an example of storing a string variable: 10 LET A$="ALPHABET SOUP NO 123" You can have a numeric variable called A and a string variable called A$. The $ lets BASIC know how to tell them apart. NOTE: For both numeric and string variables, only the first 2 characters of the variable names are valid. Also, they cannot resemble the name of any command. Examples: TOTAL is interpreted as the TO command and POTATO is interpreted as variable PO. CONSTANTS A constant is something that doesn't change. The computer stores it in memory just like a variable. However, since a constant doesn't change it has no variable name. The number 6 is a constant; so is 4.567 or 28967.35. "QUICK BROWN FOX" is a string constant. You can store constants to a variable. That's usually done to start out a program; later the contents of the variables change. Suppose we want to count to 10. Type in this program: New 10 N=0 20 N=N+1 30 PRINT N 40 IF N

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

39
VARIABLE NAMES
CONTENTS
A
675
B
2.3434
C$
CURTIS
A$
ALPHABET SOUP
Here’s an example of storing a string variable:
10
LET A$=“ALPHABET SOUP NO 123”
You can have a numeric variable called A and a string variable called A$.
The $ lets
BASIC
know how to tell them apart.
NOTE
: For both numeric and string variables, only the first 2 characters of the variable
names are valid.
Also, they cannot resemble the name of any command.
Examples
:
TOTAL
is interpreted as the
TO
command and
POTATO
is interpreted as variable
PO
.
CONSTANTS
A constant is something that doesn’t change.
The computer stores it in memory just like
a variable.
However, since a constant doesn’t change it has no variable name.
The number
6 is a constant; so is 4.567 or 28967.35.
“QUICK BROWN FOX” is a string constant.
You can store constants to a variable.
That’s usually done to start out a program; later
the contents of the variables change.
Suppose we want to count to 10.
Type in this program
:
New
press
ENTER
10
N=0
press
ENTER
20
N=N+1
press
ENTER
30
PRINT N
press
ENTER
40
IF N<10 THEN 20
press
ENTER