Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Select case

331 views

Published on

Published in: Education, Lifestyle, Business
  • Be the first to comment

  • Be the first to like this

Select case

  1. 1. SELECT CASE THE FANCY IF
  2. 2. The Problem With IF . . .IF it is cold out THEN you will put a coat onELSE 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. 3. The Problem With IF . . .IF it is cold out THEN you will put a coat onELSE leave the coat at homeIF its raining THEN you will put a coat onELSE leave the coat at home But what if its sunny! We’re going to have make another IF statement
  4. 4. The Problem With IF . . .IF it is cold out THEN you will put a coat onELSE leave the coat at homeIF its raining THEN you will put a coat onELSE leave the coat at homeIF its sunny THEN go and get you sunglassesELSE leave the sunglasses at home BUT WHAT IF ITS SNOWING!
  5. 5. The Problem With IF . . .IF it is cold out THEN you will put a coat onELSE leave the coat at homeIF its raining THEN you will put a coat onELSE leave the coat at homeIF its sunny THEN go and get you sunglassesELSE leave the sunglasses at homeIF its snowing THEN go put on your snow joggersELSE leave the snow joggers at home This isn’t very efficient! Plus its confusing
  6. 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. 7. Select Case To The Rescue! In Select case, a variable is tested using a criteria.Case: Cold or Case: Sunny?raining? Get yourGet your coat sunglasseson! Case: Snow? Get your snow Weather joggers on
  8. 8. Select Case in VBSelect Case WEATHER Case cold, raining put your coat on! Case sunny put your sunglasses on Case snow put your snow joggers onEnd Select

×