EasyManuals Logo

Sinclair QL Beginner's Guide

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
Page #25 background imageLoading...
Page #25 background image
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

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Sinclair QL and is the answer not in the manual?

Sinclair QL Specifications

General IconGeneral
ProcessorMotorola 68008
Clock Speed7.5 MHz
RAM128 KB (expandable to 640 KB)
ROM48 KB
Operating SystemSinclair QDOS
Release Year1984
StorageMicrodrive tape loop
Graphics256x256 pixels, 8 colors
PortsRS-232, ROM cartridge
SoundBeeper (internal speaker)

Related product manuals