loops and arrays
TRANSCRIPT
LOOPSLoop statement allow you to execute one or more lines of codes repeatedly, where the operations must be repeated over and over again.
TYPES
DO LOOPDO
WHILE
DO UNTIL
FOR NEXT
WHILE WEND
DO LOOP
DO WHILE
DO UNTIL
FOR…NEXT
• It requires that you know how many times the statement in the loop will be executed.
WHILE…WEND
• It executes a block of statements while a condition is True.
ARRAYS
Array is a set of element of the same datatype represented by a single variable name.
Each element of an array has a unique identifying index number which is used for assessing the elements.
DECLARING AN ARRAY:
SYNTAX: Dim array name (array size) [as datatype]
FLOW CHART OF ARRAY
TYPES OF ARRAY
ONE DIMENSIONAL
• Has only one index or subscript.• It is like a list of items that consists
of one rows and one column of item.
• Syntax: Dim array name (array size) as datatype
MULTI-DIMENSIONAL
• Have higher dimensions.• N-dimensional array can have n
dimensions.• Syntax: Dim array name
(index1, index2 – index n) as datatype
STATIC
• Size always remain the same.
• Its size and dimensions are specified with its declaration.
DYNAMIC
• Size can be changed at run-time.
TYPES Cont..