EasyManua.ls Logo

Sinclair QL

Sinclair QL
135 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
10 LET weekday$ = "FIRST"
20 LET word$ = "OF"
30 LET month$ = "FEBRUARY"
40 LET length1 = LEN (weekday$)
50 LET length2 = LEN (word$)
60 LET length3 = LEN (month$)
70 LET sum = length1 + length2 + length3
80 LET average = sum/3
90 PRINT average
RUN
The symbol / means divided by. The output or result of running the program is simply:
5
And there are eight internal pigeon holes involved:
weekday$
FIRST
length1
5
word$
OF
length2
2
month$
FEBRUARY
length3
3
sum
15
average
5
If you think that is a lot of fuss for a fairly simple problem you can certainly shorten it. The shortest
version would be a single line but it would be less easy to read. A reasonable compromise uses the
symbol "&" which stands for the operation:
Join two strings
Now type:
NEW
10 LET weekday$ = "FIRST"
20 LET word$ = "OF"
30 LET month$ = "FEBRUARY"
40 LET phrase$ = weekday$ & word$ & month$
50 LET length = LEN(phrase$)
60 PRINT length/3
RUN
The output is 5 as before but there are some different internal effects:
Weekday$
FIRST
Length
15

Other manuals for Sinclair QL

Related product manuals