Checking for variable content

Results 1 to 5 of 5

Thread: Checking for variable content

  1. #1
    Conrad Guest

    Default Checking for variable content

    What is the best way to see if a variable is holding a value? Such as:<BR><BR>If (variabel has value) Then<BR> blah,blah,blah<BR>End If<BR><BR><BR>Thanks<BR>Conrad.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Checking for variable content

    Try response.write to output the value of that variable.

  3. #3
    Joel Nelson Guest

    Default RE: Checking for variable content

    In VBScript:<BR><BR>If (variableName = value) Then<BR>.....<BR>End If<BR><BR><BR>In JavaScript:<BR><BR>if (variableName == value)<BR>{<BR>......;<BR>......;<BR>......;<BR>}< BR><BR>If only executing ONE line of code you can do this in JS:<BR><BR>if (variableName == value)<BR>statement to execute;<BR><BR><BR><BR>

  4. #4
    Conrad Guest

    Default Clarification

    I need to see if a value has been assigned to a variable. I need this for some logic. The actual value makes no difference, only that it holds a value.<BR><BR>Thanks.

  5. #5
    tension Guest

    Default RE: Clarification

    You could go with the isEmpty() function. Cut and past code below to see:<BR><BR>&#060;%<BR>Dim varTest<BR>Response.Write "&#060;hr&#062;"<BR>Response.Write "*" & varTest & "*"<BR>Response.Write "*" & IsEmpty(varTest) & "*"<BR>varTest = "Some Value"<BR>Response.Write "*" & IsEmpty(varTest) & "*"<BR>Response.Write "&#060;hr&#062;"<BR>%&#062;<BR><BR>More on syntax over at:<BR><BR><BR>or you could just use<BR>If varTest = "" Then<BR> STOP<BR>Else<BR> Do some stuff<BR>End If<BR><BR>-Laffit

Posting Permissions

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