Vtech PreComputer Power Pad Plus User Manual - Page 41

Let B=10, Let B=15, Let C=a+b, Print First Number; A, Print Second Number; B, Print The Sum Is

Page 41 highlights

The computer creates a box in memory and calls it "A". It puts the number 8 in this box. Now type: 20 LET B=10 press ENTER The computer creates a box called "B" and places 10 into it. Type: 30 LET B=15 press ENTER Since there is a box called "B" already with a value of 10 in it, it doesn't make another box called "B" with a value of 15 in it. The number 10 is just replaced with the number 15. Now type: 40 LET C=A+B press ENTER This statement is a bit more complicated. Here's how it works. First, the computer searches for a memory box called "B" and finds the number 15. The "+" sign tells the computer to add the numbers found in "A" and "B" together. It computes this and the answer is 23. Now, where is the answer placed? The "=" tells the computer to store the answer in a memory box called "C". The computer searches for a box called "C". It doesn't find one so it creates one in memory and then puts the answer there. Of course, if there was a memory variable called "C" that had a number in it from a previous operation, the old number would be replaced by the new one in this statement. Now let's finish this by typing: 50 PRINT "FIRST NUMBER"; A press ENTER 60 PRINT "SECOND NUMBER"; B press ENTER 70 PRINT "THE SUM IS"; C press ENTER RUN 37

  • 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

37
The computer creates a box in memory and calls it “A”.
It puts the number 8 in this box.
Now type
:
20
LET B=10
press
ENTER
The computer creates a box called “B” and places 10 into it.
Type
:
30 LET B=15
press
ENTER
Since there is a box called “B” already with a value of 10 in it, it doesn’t make another
box called “B” with a value of 15 in it.
The number 10 is just replaced with the number
15.
Now type
:
40
LET C=A+B
press
ENTER
This statement is a bit more complicated.
Here’s how it works.
First, the computer searches
for a memory box called “B” and finds the number 15.
The “+” sign tells the computer
to add the numbers found in “A” and “B” together.
It computes this and the answer is
23.
Now, where is the answer placed?
The “=” tells the computer to store the answer
in a memory box called “C”.
The computer searches for a box called “C”.
It doesn’t find
one so it creates one in memory and then puts the answer there.
Of course, if there was a memory variable called “C” that had a number in it from a previous
operation, the old number would be replaced by the new one in this statement.
Now let’s finish this by typing
:
50
PRINT “FIRST NUMBER”; A
press
ENTER
60
PRINT “SECOND NUMBER”; B
press
ENTER
70
PRINT “THE SUM IS”; C
press
ENTER
RUN