EasyManua.ls Logo

AMSTRAD CPC464 - Def Fn; Deg

AMSTRAD CPC464
249 pages
Print Icon
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...
DEF FN
DEF FN <name> (<formal parameters>)]=<general expression>
10 DEF FNinterest(principle)=l.l4*principle
20 INPUT "What is the principle sum";principle
30 PRINT "The amount owing plus interest
after one year is ”;FNinterest(principle)
COMMAND: BASIC allows the program to define and use simple value returning functions. DEF
FuNction is the definition part of this mechanism and creates program-specific function which works
within the program in the same way as a function such as COS operates as a built-in function of
BASIC.
It may be invoked throughout the program. Variable types must be consistent and the DEF
FuNction command should be written in part of the program outside the execution loop.
DEFINT
DEFSTR
DEFREAL
DEF type range(s) of letters,
DEFINT I-N
DEFSTR A,W-2
DEFREAL
COMMAND: Define default variable types where type is integer, real or string. The variable will be
set according to the first letter of the variables name which may be either upper or lower case.
Associatedkeywords: LOAD, RUN, CHAIN,NEW, CLEAR
DEG
DEG
DEG
COMMAND: Set degrees mode. The default condition is for functions such as SIN and COS is to
assume radian measure for numeric data. The command sets to degree mode until instructed
otherwise by a CLEAR or RAD - or if any new program is loaded.
Associated keywords: RAD

Table of Contents

Other manuals for AMSTRAD CPC464

Related product manuals