The Val Function; The Str$ Function; The Square Root Function (Sqr); The Absolute Value Function (Abs) - Commodore 128 System Manual

Table of Contents

Advertisement

The VAL Function

The VAL function returns a numeric value for a string argument.
Clear the computer's memory and type in this program:
10 A $=" 64"
20 A=VAL(A$)
30 ? "THE VALUE OF " ;A$;" IS";A
40 END

The STR$ Function

The STR$ function returns the string representation of a numeric
value. Clear the computer's memory and type this program.
10 A=65
20 A$=STR$(A)
30 ? A" IS THE VALUE OF ";A$

The Square Root Function (SQR)

The square root function is SQR. For example, to find the square
root of 50, type:
? SQR(50)
You can find the square root of any positive number in this way.

The Absolute Value Function (ABS)

The absolute value function (ABS) is very useful in dealing with
negative numbers. You can use this function to get the positive
value of any numberpositive or negative. Try these examples:
? ABS(-10)
? ABS(5)" IS EQUAL TO "ABS(-5) n m m n

THE STOP AND CONT (CONTINUE) COMMANDS

You can make the computer stop a program, and resume running
it when you are ready. The STOP command must be included in
the program. You can put a STOP statement anywhere you want
to in a program. When the computer "breaks" from the program
(that is, stops running the program), you can use DIRECT mode
commands to find out exactly what is going on in the program.
RETURN
RETURN
4-23

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents