Connecting Tech Pros Worldwide Help | Site Map

Multiple if statements

Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#1: Jun 29 '09
Hi, I have a simple problem. I need three if statements like the following but without the else. Just three simple conditions. is it best to use a case statement instead? Thanks for any help. Also if one needs some custom coding done is it possible to post on the job section?


Richard

Expand|Select|Wrap|Line Numbers
  1. If Session("Authorizationlevel") ="1" then
  2. bla
  3.  
  4. If Session("Authorizationlevel") ="2" then
  5. bla
  6.  
  7. If Session("Authorizationlevel") ="3" then
  8.  
  9. bla
Sorry I worked it out as

Expand|Select|Wrap|Line Numbers
  1. If Session("Authorizationlevel") ="1" then
  2. bla
  3. Else
  4. end if
  5.  
  6. If Session("Authorizationlevel") ="2" then
  7. bla
  8. Else
  9. end if
  10. If Session("Authorizationlevel") ="3" then
  11. bla
  12. Else
  13. end if
  14. bla
with the else.
Thanks
Richard
GazMathias's Avatar
Expert
 
Join Date: Oct 2008
Location: Bristol, United Kingdom
Posts: 143
#2: Jun 29 '09

re: Multiple if statements


Quote:
is it best to use a case statement instead?
I would agree with that, yes.
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#3: Jun 29 '09

re: Multiple if statements


Quote:

Originally Posted by GazMathias View Post

I would agree with that, yes.

me too. as long as your logic branches off from a single variable that can have more than two values, you should definitely use a select case.

Jared
Reply