Connecting Tech Pros Worldwide Help | Site Map

Multiple if statements

  #1  
Old June 29th, 2009, 03:35 PM
Familiar Sight
 
Join Date: Jul 2006
Posts: 181
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
  #2  
Old June 29th, 2009, 03:56 PM
GazMathias's Avatar
Expert
 
Join Date: Oct 2008
Location: Bristol, United Kingdom
Posts: 138

re: Multiple if statements


Quote:
is it best to use a case statement instead?
I would agree with that, yes.
  #3  
Old June 29th, 2009, 10:47 PM
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,686

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
using multiple 'if' statements in Python RaZe answers 2 July 14th, 2008 01:57 PM
Multiple if statements dozingquinn answers 2 October 4th, 2007 11:09 AM
Multiple 'If' statements - is there a better way to write this? patelxxx answers 3 August 15th, 2007 10:33 AM
Multiple if statements in single while loop--HELP ickypick answers 1 September 11th, 2006 12:55 AM