Académique Documents
Professionnel Documents
Culture Documents
Addison Wesley
is an imprint of
2011 Pearson Addison-Wesley. All rights reserved.
Addison Wesley
is an imprint of
Chapter 4
Making Decisions
Copyright 2011 Pearson Addison-Wesley
Introduction
IfThen
IfThenElse
IfThenElseIf
Select Case
Radio Buttons
Check Boxes
Message Boxes
Input Validation
Chapter 4 lide
!
Copyright 2011 Pearson Addison-Wesley
Addison Wesley
is an imprint of
2011 Pearson Addison-Wesley. All rights reserved.
Addison Wesley
is an imprint of
ection 4"#
The Decision tructure
-lo$chart of a
t+pical decision
structure
'valuate the
condition
Is it cold outside.
'xecute or skip
over some code
ection 4"!
The If"""Then tatement
ection 4"<
The If"""Then"""'lse tatement
If the
expression is
True
execute the
statements
)et$een If
Then and Else
If the
expression is
9alse
execute the
statements
)et$een Else
and End If
Chapter 4 lide
#1
If expression Then
statement
(more statements may follow)
'lse
statement
(more statements may follow)
'nd If
Copyright 2011 Pearson Addison-Wesley
-lo$chart and 8seudocode
Chapter 4 lide
#5
dblTemperature
< 40?
Display Message
A little cold, isnt it?
True
False
Display Message
Nice weather were
having!
If temperature < 40 Then
Display the message A little cold, isnt it?
!lse
Display the message "ice #eather #ere ha$ing%
!nd If
Copyright 2011 Pearson Addison-Wesley
T$o Mutuall+ 'xclusive Choices
ection 4"4
The If"""Then"""'lseIf tatement
In pseudocode6
Chapter 4 lide
!#
If it is $ery cold Then
&ear a coat
!lseif it is chilly
&ear a light 'ac(et
!lseif it is #indy
&ear a #ind)rea(er
!lseif it is hot
&ear no 'ac(et
Copyright 2011 Pearson Addison-Wesley
Multiple 8ossi)le Choices