Functions

BASIC-80

LEN

The string function LEN(X$) returns the length, in number of characters, of string X$. All characters are counted, including non-printing characters and blanks.

LEN (string expression)

10X$ = "JOHN J. JONES"

20PRINT LEN(X$)

30END

RUN

Ok

LOC

The LOC function has two uses. When used with a random file, LOC returns the current sector number. The current sector is defined as the last sector that was read or written. If no sectors have been read or written, LOC returns to O. When used with a sequential file, LOC returns the number of sectors read or written to since the last OPEN statement was executed on that file.

LOC (file number)

10OPEN "R", #3, :F1 :RANDOM

20GET #3,44

30PRINT LOC (3)

40END

RUN

Ok

LOF

The LOF function returns the number of sectors in a random file. When LOF is used with a sequential file, it returns the number of data sectors (128 bytes per sector) in the file.

LOF (file number)

PRINT LOF(4) 33

LOG

The LOG function returns the natural logarithm of the argument. The calculation is performed in single precision.

LOG(expression)

10 INPUT A

20B = LOG (A)

30PRINT A

40END

RUN ? 2488 7.81924 Ok

7-8

Page 72
Image 72
Intel 9800758-02 manual Len, Loc, Lof, Log