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 #24 background imageLoading...
Page #24 background image
LENGTHS OF STRINGS
SuperBASIC makes it easy to find the length or number of characters of any string. You simply write,
for example:
PRINT LEN(weekday$)
If the pigeon hole, weekday$, contains FIRST the number 5 will be displayed. You can see the effect
in a simple program:
NEW
10 LET weekday$ = "FIRST"
20 PRINT LEN(weekday$)
RUN
The screen should display:
5
LEN is a keyword of SuperBASIC
An alternative method of achieving the same result uses both a string pigeon hole and a numeric
pigeon hole.
NEW
10 LET weekday$ = "FIRST"
20 LET length = LEN(weekday$)
30 PRINT length
RUN
The screen should display:
5
as before, and two internal pigeon holes contain the values shown:
weekday$
FIRST
length
5
Let us return to the problem of average lengths of words.
Write a program to find the average length of the three words:
FIRST, OF, FEBRUARY
PROGRAM DESIGN
When problems get beyond what you regard as very trivial, it is a good idea to construct a program
design before writing the program itself
1. Store the three words in pigeon holes.
2. Compute the lengths and store them.
3. Compute the average.
4. Print the result.
NEW

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