Skip to Content
Absolute Beginner's Guide to Programming, Third Edition
book

Absolute Beginner's Guide to Programming, Third Edition

by Greg Perry
November 2002
Beginner content levelBeginner
432 pages
11h 44m
English
Que
Content preview from Absolute Beginner's Guide to Programming, Third Edition

Nesting If...Else Statements

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.

Listing 8.2. Combining Nested If...Else Statements with ElseIf
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

caution

The Not logical operator works on a single value, unlike the other ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Absolute Beginner's Guide to Programming, Second Edition

Absolute Beginner's Guide to Programming, Second Edition

Greg Perry

Publisher Resources

ISBN: 0789729059Purchase book