Professional Documents
Culture Documents
PART 2
Strings
A string is any combination of letters, numbers or
symbols surrounded by double quotes " "
Two strings are considered equal if and only if
each and every character is identical
– “Bob” is equal to “Bob”
– but not equal to “BOB”, “bob” or “Robert”
Strings can be manipulated in assignment
statements
Review of Comparisons
Comparisons can be made on both numeric and
string data types
The comparison operators in Visual Basic are
– < Less Than
– > Greater Than
– = Equal
– <= Less Than or Equal
– >= Greater Than or Equal
– <> Not Equal
Review of Comparisons
Sometimes, a simple test is not adequate for a
conditional branch or loop instruction. We need a
more complex test that combines the results of
multiple simple tests
In this case, we can use the logical (Boolean)
operators to combine test results
The logical operators, in order of precedence, are
• AND: returns a True only when both conditions are True
• OR: returns a True when either or both conditions are True
Review of Comparisons
Let X = 5, Y = 6
FOR J = 1 TO 4
Instruction block
NEXT J
A variation is: