April 2001
Beginner
432 pages
10h 27m
English
If you nest one If...Else statement inside another, you'll have to use ElseIf to start the nested statement. Consider the code in Listing 8.2.
If (intHours <= 40) Then
curOverTime = 0.0
'Now test for hours between 40 and 50
'and pay time and a half
ElseIf (intHours <= 50) Then
curOverTime = (intHours - 40) * 1.5 * sngRate
Else
'Must pay double time over 50 and
'time and a half for the hours between
'40 and 50
curOverTime = ((intHours - 50) * 2 + (10 * 1.5)) * sngRate
End If
|
The ElseIf statement in the fifth line starts a new If...Else block of code. If the value of intHours is not 40 or less in the first line, it must be more than 40. Therefore, ...
Read now
Unlock full access