Def Fn; Deg - AMSTRAD CPC464 User Manual

Cpc464 colour personal computer 64k
Hide thumbs Also See for CPC464:
Table of Contents

Advertisement

DEF FN

DEF FN <n a m e > ( < f o r m a l p a r a m e t e r s > ) ] = < g e n e r a l e x p r e s s i o n >
1 0 D E F F N i n t e r e s t ( p r i n c i p l e ) = l . l 4 * p r i n c i p l e
2 0 I N P U T " W h a t i s t h e p r i n c i p l e s u m " ; p r i n c i p l e
3 0 P R I N T " T h e a m o u n t o w i n g p l u s i n t e r e s t
a f t e r o n e y e a r i s "; F N i n t e r e s t ( p r i n c i p l e )
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
D E F t y p e r a n g e ( s ) o f l e t t e r s ,
D E F I N T I-N
D E F S T R A , W-2
D E F R E A L
COMMAND: Define default variable types where ' type' is integer, real or string. The variable will be
set according to the first letter of the variable' s name – which may be either upper or lower case.
Associatedkeywords: L O A D , R U N , C H A I N , N E W , C L E A R

DEG

D E G
D E G
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

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents