Well Come to Professional Programmers

Learning Goal

Learning is a process to acquire, enhance, or make changes in one's knowledge. Learning Module presents essential and masks non-essential pieces of knowledge. It is self paced and presents required links to important examples and related terminologies essentially required for examination centric study. The module is focused on examination system in vogue in Pakistan and helps student acquire maximum marks in limited time of study.

GW-BASIC COUNTER

SubPrograms

SubPrograms

Types:

(1) Functions (2) Subroutine

(1) Functions

In 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 Functions

ABS(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 Functions

CHR$(n) DATE$ HEX$(a) MID$(STRING $, n1, n2) OCT$(N) RIGHT$(STRING $, N) LEFT$(STRING $, N) SPACE$(A) TIME$

(b) User Defined Functions

DEF FN name [Argument] expression

(2) Subroutine

GOSUB 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.