SlideShare a Scribd company logo
CONDITIONAL STATEMENTS
IF Statement Allows your program to make decisions based on certain conditions.
1. If… Then Syntax:  If  condition  Then Statement/s End If
2. If… Then… Else Syntax:  If  condition  Then Statement/s Else Statement/s End If
IF… ELSEIF Statement If  1 st  condition   Then statement if the 1st condition is true ElseIf   2 nd  condition   Then statement if the 2nd condition is true   Else     statement if ALL conditions are false End If
Select Case Structure useful when you want to check a variable or an expression against multiple possible values
Syntax for  “ Select Case ” Select Case  expression or variable Case  range, constant, or variable ‘ Statements Case  range, constant, or variable ‘ Statements Case  range, constant, or variable ‘ Statements Case Else ‘ Statements End Select
Select Case lboColor.Text Case “red”, “purple”, “orange” lblRemark.Text = “This is a warm color.” Case “blue”, “green”, “blue violet” lblRemark.Text = “This is a cool color.” Case Else lblRemark.Text = “Please select a color.” End Case
Select Case Val(T xtAge .Text) Case 1 To 3 lblRemark .Text = "toddlerhood" Case 4 To 8 lblRemark .Text = "childhood" Case 9 To 12 lblRemark .Text = "preadolescence" Case 13 To 18 lblRemark .Text = "adolescence" Case 19 To 24 lblRemark .Text = "young adulthood" Case Is > 24 lblRemark .Text = "adulthood" Case Else lblRemark .Text = "infancy" End Select

More Related Content

PPTX
Working with comparison operators
DOCX
Data type
PPT
9 case
PDF
Pre-Cal 30S December 18, 2008
PPTX
Conditional statement ss1
PPTX
Vb decision making statements
PPTX
If and select statement
PPTX
If and select statement
Working with comparison operators
Data type
9 case
Pre-Cal 30S December 18, 2008
Conditional statement ss1
Vb decision making statements
If and select statement
If and select statement

Similar to Select Case (20)

PPTX
Decision statements
DOC
Conditional expressions
PPTX
Conditional statements
PPTX
Using decision statements
PPTX
Decisions
PPTX
Select case
PPTX
Conditional statements
PPTX
If Else .. Select Case in VB.NET
PPTX
Decisions
PPTX
Decisions
PPT
Mesics lecture 6 control statement = if -else if__else
PPT
ch1. .ppt
PPT
selection.ppt
PPT
Chapter 1 Nested Control Structures
PPTX
IF Statement
PDF
if else.pdf
PPT
Conditional statements in sas
PPT
Vba class 4
PPT
Chapter 1 nested control structures
PPTX
Decision structures chpt_5
Decision statements
Conditional expressions
Conditional statements
Using decision statements
Decisions
Select case
Conditional statements
If Else .. Select Case in VB.NET
Decisions
Decisions
Mesics lecture 6 control statement = if -else if__else
ch1. .ppt
selection.ppt
Chapter 1 Nested Control Structures
IF Statement
if else.pdf
Conditional statements in sas
Vba class 4
Chapter 1 nested control structures
Decision structures chpt_5
Ad

Recently uploaded (20)

PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
Getting Started with Data Integration: FME Form 101
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
The various Industrial Revolutions .pptx
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
DP Operators-handbook-extract for the Mautical Institute
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
STKI Israel Market Study 2025 version august
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PPTX
Tartificialntelligence_presentation.pptx
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Getting started with AI Agents and Multi-Agent Systems
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Hybrid model detection and classification of lung cancer
Univ-Connecticut-ChatGPT-Presentaion.pdf
WOOl fibre morphology and structure.pdf for textiles
Getting Started with Data Integration: FME Form 101
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
The various Industrial Revolutions .pptx
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Enhancing emotion recognition model for a student engagement use case through...
DP Operators-handbook-extract for the Mautical Institute
O2C Customer Invoices to Receipt V15A.pptx
Chapter 5: Probability Theory and Statistics
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
STKI Israel Market Study 2025 version august
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
Tartificialntelligence_presentation.pptx
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Final SEM Unit 1 for mit wpu at pune .pptx
Getting started with AI Agents and Multi-Agent Systems
Group 1 Presentation -Planning and Decision Making .pptx
Hybrid model detection and classification of lung cancer
Ad

Select Case

  • 2. IF Statement Allows your program to make decisions based on certain conditions.
  • 3. 1. If… Then Syntax: If condition Then Statement/s End If
  • 4. 2. If… Then… Else Syntax: If condition Then Statement/s Else Statement/s End If
  • 5. IF… ELSEIF Statement If 1 st condition Then statement if the 1st condition is true ElseIf 2 nd condition Then statement if the 2nd condition is true Else statement if ALL conditions are false End If
  • 6. Select Case Structure useful when you want to check a variable or an expression against multiple possible values
  • 7. Syntax for “ Select Case ” Select Case expression or variable Case range, constant, or variable ‘ Statements Case range, constant, or variable ‘ Statements Case range, constant, or variable ‘ Statements Case Else ‘ Statements End Select
  • 8. Select Case lboColor.Text Case “red”, “purple”, “orange” lblRemark.Text = “This is a warm color.” Case “blue”, “green”, “blue violet” lblRemark.Text = “This is a cool color.” Case Else lblRemark.Text = “Please select a color.” End Case
  • 9. Select Case Val(T xtAge .Text) Case 1 To 3 lblRemark .Text = "toddlerhood" Case 4 To 8 lblRemark .Text = "childhood" Case 9 To 12 lblRemark .Text = "preadolescence" Case 13 To 18 lblRemark .Text = "adolescence" Case 19 To 24 lblRemark .Text = "young adulthood" Case Is > 24 lblRemark .Text = "adulthood" Case Else lblRemark .Text = "infancy" End Select