Vtech PreComputer Power Pad Plus User Manual - Page 44

Print The Answer Is; N, Let N=10, Input Give Me A Number; N, Print Your Number Is; N, Input

Page 44 highlights

50 PRINT "THE ANSWER IS"; N press ENTER RUN The statement at line 10 stores the numeric constant zero into N, a numeric variable. In statement 20 the variable will have a numeric constant,1, added to itself and then the sum of that operation will be stored in place of the value previously stored there. The program in the above example contains a programming construction called a loop. A loop is one or more BASIC statements, usually called a set, that can be executed as many times as you want. The statement in line 40 contains an IF statement. It is called a conditional statement and will be discussed in detail under the topic called Making Decisions. INPUTTING DATA We have been putting information into the computer by typing constants into programs using statements like the following: 10 LET N=10 press ENTER 20 LET A$="NANCY LIKES CHOCOLATE CUPCAKES" Another way to supply data is by using an INPUT statement. Try this out by typing: NEW 10 INPUT "GIVE ME A NUMBER"; N 20 PRINT "YOUR NUMBER IS"; N RUN press ENTER press ENTER The unit will prompt you to input a number with the character. Type any number of digits that you like and press ENTER. You can also input alphabetic data into string variables like this program: 10 INPUT "WHAT IS YOUR NAME"; N$ press ENTER 20 PRINT "HI THERE"; N$ 40

  • 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

40
50
PRINT “THE ANSWER IS”; N
press
ENTER
RUN
The statement at line 10 stores the numeric constant zero into N, a numeric variable.
In
statement 20 the variable will have a numeric constant,1, added to itself and then the sum
of that operation will be stored in place of the value previously stored there.
The program in the above example contains a programming construction called a loop.
A loop is one or more
BASIC
statements, usually called a set, that can be executed as
many times as you want.
The statement in line 40 contains an
IF
statement.
It is called
a conditional statement and will be discussed in detail under the topic called
Making
Decisions
.
INPUTTING DATA
We have been putting information into the computer by typing constants into programs using
statements like the following:
10
LET N=10
press E
NTER
20
LET A$=“NANCY LIKES CHOCOLATE CUPCAKES”
Another way to supply data is by using an
INPUT
statement.
Try this out by typing:
NEW
10
INPUT “GIVE ME A NUMBER”; N
press
ENTER
20
PRINT “YOUR NUMBER IS”; N
press
ENTER
RUN
The unit will prompt you to input a number with the character.
Type any number of digits
that you like and press
ENTER
.
You can also input alphabetic data into string variables like this program:
10
INPUT “WHAT IS YOUR NAME”; N$
press
ENTER
20
PRINT “HI THERE”; N$