Syntax "if" or "case"

Results 1 to 2 of 2

Thread: Syntax "if" or "case"

  1. #1
    Join Date
    Dec 1969

    Default Syntax "if" or "case"

    Sorry to ask this question again but I really need an answer. What is the syntactical difference between an 'if' statement and a 'case' statement in ASP using VBSript? How would you code a decision that had you evaluate 5 usernames to determine which one matched your own name? Thanks!

  2. #2
    Join Date
    Dec 1969

    Default You don't mean syntax...

    Syntax is simply the way you code it legally in the language.<BR><BR>I *assume* you know the *syntax* of IF and SELECT CASE or you wouldn&#039;t be asking the question?<BR><BR>But to answer your second question:<BR><BR>&#060;%<BR>names = Array("John","Harry","Bill","Mary","Newbie101")<BR >match = -1<BR>For i = 0 To UBound(names)<BR>&nbsp; &nbsp; If names(i) = theUserName Then<BR>&nbsp; &nbsp; &nbsp; &nbsp; match = i<BR>&nbsp; &nbsp; &nbsp; &nbsp; Exit For<BR>&nbsp; &nbsp; End If<BR>Next<BR><BR>If match &#060; 0 Then Response.Write "no match" Else Response.Write "match on " & match<BR><BR><BR>%&#062;<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts