SubPrograms
Types:
(1) Functions (2) Subroutine
(1) FunctionsIn programming, a function is a routine that a value as an input, and produces a single value as an output.
Types: (a) System Defined Functions (i) Numeric System Defined FunctionsABS(X) ASC(A$) CINT(N) FIX(N) INT(A) LOG(N) RND(N) SIN(A) SPC(A) SQR(A) TAN(N) TAB(A) VAL(STRING$)
(ii) String System Defined FunctionsCHR$(n) DATE$ HEX$(a) MID$(STRING $, n1, n2) OCT$(N) RIGHT$(STRING $, N) LEFT$(STRING $, N) SPACE$(A) TIME$
(b) User Defined FunctionsDEF FN name [Argument] expression
(2) SubroutineGOSUB RETURN
Difference between Functions and Subroutin? Function:(a) A Function is pre-defined program. (b) It is used in an expression to call a predetermined operation on an operand.
Subroutine:(a) A Subroutine itself is a small program consisting of set of statements which are usually written within a main program. (b) A Subroutine can be used to calculate and return many values.
SubPrograms
Subscribe to:
Posts (Atom)