SlideShare a Scribd company logo
1 of 8
SELECT CASE
 THE FANCY IF
The Problem With IF . . .

IF it is cold out THEN you will put a coat on
ELSE leave the coat at home

          But what about if it rains!
          We don’t know what to do!

          We’re going to have to
          make another IF statement
The Problem With IF . . .
IF it is cold out THEN you will put a coat on
ELSE leave the coat at home
IF its raining THEN you will put a coat on
ELSE leave the coat at home
           But what if its sunny! We’re
           going to have make another
           IF statement
The Problem With IF . . .
IF it is cold out THEN you will put a coat on
ELSE leave the coat at home
IF its raining THEN you will put a coat on
ELSE leave the coat at home
IF its sunny THEN go and get you sunglasses
ELSE leave the sunglasses at home
          BUT WHAT IF ITS SNOWING!
The Problem With IF . . .
IF it is cold out THEN you will put a coat on
ELSE leave the coat at home
IF its raining THEN you will put a coat on
ELSE leave the coat at home
IF its sunny THEN go and get you sunglasses
ELSE leave the sunglasses at home
IF its snowing THEN go put on your snow joggers
ELSE leave the snow joggers at home
     This isn’t very efficient! Plus its confusing
Select Case To The Rescue!
• Select case is like IF but allows you to test
  many things at once in one construct

• This is
  – less confusing
  – Easier to type up
  – Easier to modify
Select Case To The Rescue!
 In Select case, a variable is tested using a criteria.


Case: Cold or                           Case: Sunny?
raining?                                Get your
Get your coat                           sunglasses
on!
                                        Case: Snow?
                                        Get your snow
                     Weather
                                        joggers on
Select Case in VB
Select Case WEATHER
    Case cold, raining
        put your coat on!
    Case sunny
        put your sunglasses on
    Case snow
        put your snow joggers on

End Select

More Related Content

Viewers also liked (11)

Sf Group Presentation
Sf Group PresentationSf Group Presentation
Sf Group Presentation
 
Melakukan perbaikan peripheral
Melakukan perbaikan peripheralMelakukan perbaikan peripheral
Melakukan perbaikan peripheral
 
Savonuk
SavonukSavonuk
Savonuk
 
особливості реалізації основних положень концепції розвитку психологічної слу...
особливості реалізації основних положень концепції розвитку психологічної слу...особливості реалізації основних положень концепції розвитку психологічної слу...
особливості реалізації основних положень концепції розвитку психологічної слу...
 
Психологічна допомога дітям у кризовому стані
Психологічна допомога дітям у кризовому станіПсихологічна допомога дітям у кризовому стані
Психологічна допомога дітям у кризовому стані
 
Master SmmUS 2015/2016 - Gestión de comunidades y crisis online
Master SmmUS 2015/2016 - Gestión de comunidades y crisis onlineMaster SmmUS 2015/2016 - Gestión de comunidades y crisis online
Master SmmUS 2015/2016 - Gestión de comunidades y crisis online
 
Arrays
ArraysArrays
Arrays
 
Syntax errors
Syntax errorsSyntax errors
Syntax errors
 
Melakukan perbaikan peripheral
Melakukan perbaikan peripheralMelakukan perbaikan peripheral
Melakukan perbaikan peripheral
 
комп`ютерна залежність
комп`ютерна залежністькомп`ютерна залежність
комп`ютерна залежність
 
Variables
VariablesVariables
Variables
 

More from Peter Andrews

More from Peter Andrews (7)

Trimming text
Trimming textTrimming text
Trimming text
 
Splitting up text
Splitting up textSplitting up text
Splitting up text
 
Is numeric
Is numericIs numeric
Is numeric
 
Loops
LoopsLoops
Loops
 
Collecting user input
Collecting user inputCollecting user input
Collecting user input
 
Hello world
Hello worldHello world
Hello world
 
Flow charts
Flow chartsFlow charts
Flow charts
 

Recently uploaded

QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 

Recently uploaded (20)

dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 

Select case

  • 1. SELECT CASE THE FANCY IF
  • 2. The Problem With IF . . . IF it is cold out THEN you will put a coat on ELSE leave the coat at home But what about if it rains! We don’t know what to do! We’re going to have to make another IF statement
  • 3. The Problem With IF . . . IF it is cold out THEN you will put a coat on ELSE leave the coat at home IF its raining THEN you will put a coat on ELSE leave the coat at home But what if its sunny! We’re going to have make another IF statement
  • 4. The Problem With IF . . . IF it is cold out THEN you will put a coat on ELSE leave the coat at home IF its raining THEN you will put a coat on ELSE leave the coat at home IF its sunny THEN go and get you sunglasses ELSE leave the sunglasses at home BUT WHAT IF ITS SNOWING!
  • 5. The Problem With IF . . . IF it is cold out THEN you will put a coat on ELSE leave the coat at home IF its raining THEN you will put a coat on ELSE leave the coat at home IF its sunny THEN go and get you sunglasses ELSE leave the sunglasses at home IF its snowing THEN go put on your snow joggers ELSE leave the snow joggers at home This isn’t very efficient! Plus its confusing
  • 6. Select Case To The Rescue! • Select case is like IF but allows you to test many things at once in one construct • This is – less confusing – Easier to type up – Easier to modify
  • 7. Select Case To The Rescue! In Select case, a variable is tested using a criteria. Case: Cold or Case: Sunny? raining? Get your Get your coat sunglasses on! Case: Snow? Get your snow Weather joggers on
  • 8. Select Case in VB Select Case WEATHER Case cold, raining put your coat on! Case sunny put your sunglasses on Case snow put your snow joggers on End Select