Fatskills
Practice. Master. Repeat.
Study Guide: Key Points - Visual Basic Control Structures
Source: https://www.fatskills.com/class-12-informatics-practices/chapter/key-points-visual-basic-control-structures

Key Points - Visual Basic Control Structures

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~3 min read

CONTROL FLOW
1. SEQUENTIAL:

It means the statements are being executed sequentially. This represents default flow of statements.
Statement 1
Statement 2
Statement 3

2. SELECTION (Decision construct)
Selection construct select their course of action depending upon the result of a condition's) or
Boolean expression's).
Yes
Condition
No
Statement 1
Statement 2
Statement 3

3. ITERATION (Repetition)/ Looping: Iteration means repetition of a set-of-statement depending upon a condition test. A loop is a set of statements that are repeated a certain number of times. The block of statements written in between the loop gets executed as many number of times as the user wants
FALSE
Condition
TRUE
Statement 1
Statement 2

Rules for using Iteration: The 3 steps involve in a loop are:
– Initialization

- of counter variable
– Test condition
- for testing the value of the counter variable
– Updation
- Increase/decrease the value of counter variable

Two Forms of SELECTION CONSTRUCT  Two Way Branching
IF Statement o If …. Then ….. End If o If …. Then ... Else …. End If o Nested If o If…. Then …. Else If …. End IF o IIF ( exp1, <true>, <false>)
 Multi Way Branching
Select Case : It can be used with the following 3 forms:
 Exact Match
 A Relational Case Match
 A Range of Case Match

Various Forms of LOOPING CONSTRUCT –

Entry controlled / Pre tested / Top tested Loops: Condition is tested first then if it is true the body of loop executes.
NOTE: This type of loops executed for zero or more times. o o o o

While ….. Wend
Do while ….. Loop
Do Until ….. Loop
For …… Next
Exit controlled / Post tested / Bottom tested Loops: Body of loop executed once and then condition is tested, if it is true body of loop continues.
NOTE: This type of loops executed at least once. o Do ….. Loop While o Do ….. Loop Until

For Each ….. Next

ARRAY: Arrays is a group of homogenous elements.
- An array is a collection of variables of the same data type that are referenced by a common name.

Arrays are of Two Types:
1. Fixed / Static size Array: Those arrays in which the no. of elements is fixed and does not vary.
2. Dynamic size Array : Dynamic arrays are those arrays whose no. of elements can be varied.


Declaration of Array:
Fixed size
Dim ArrayName(size) as DataType Eg: Dim arr(4) as Integer
Dynamic size Dim ArrayName( ) as DataType
Eg: Dim arr1( ) as Integer
Zero – based and One – based Indexing: If an array is declared as arr(4) it means we count these element from 0 to 4 ie. 5 elements, so this is known as Zero – based Indexing.
And if an array is declared as arr(1 to 5) it means we count these element from 1 to 5 ie. 5 elements, so this is known as One – based Indexing.



ADVERTISEMENT