compare variables?

1. Junior Member
Join Date
Dec 1969
Posts
8

## compare variables?

Can someone help me with comparing variables in a IF THEN ELSE<BR>statement?<BR><BR>I&#039ve got to variables from a array:<BR>a(0,0) = 03 and a(0,1) = May<BR><BR>And I wan&#039t to compare them with actualmonth and today<BR>wich I get from:<BR><BR>actual=Month(Now)<BR>actualmonth=Mont hName(actual)<BR>today=Day(Now)<BR><BR>I&#039m trying to write a statement:<BR>IF a(0,0)=today AND a(0,1)=actualmonth THEN<BR> rowcolor="#C0C0C0"<BR> END IF<BR><BR>But I don&#039t get it to work.<BR>If I write like this it works just fine:<BR><BR>IF a(0,0)="03" AND a(0,1)="May" THEN<BR> rowcolor="#C0C0C0"<BR> END IF<BR><BR>If I ResponseWrite the variables like this<BR>&#060;%=today%&#062;&#060;%=actualmonth%&# 062;<BR>I get 3May <BR><BR>Any suggestion how to solve this???<BR>Thanks in advance. /Milo<BR><BR>

2. Junior Member
Join Date
Dec 1969
Posts
6

## RE: compare variables?

When you say var1=var2 you are actually changing the value of var1 you need a double equals for comparison.<BR><BR>if var1 == var2<BR>{<BR>Do something<BR>}<BR>else<BR>{<BR>Do something else<BR>}<BR>endif<BR><BR>I hope this helps<BR>Pauline

3. Junior Member
Join Date
Dec 1969
Posts
8

## RE: compare variables?

4. Junior Member
Join Date
Dec 1969
Posts
6

## RE: compare variables?

I don&#039t know if this will work either but it is worth a try.<BR><BR>IF (a(0,0)==today) AND (a(0,1)==actualmonth) THEN<BR>rowcolor="#C0C0C0"<BR>END IF<BR><BR>Or try nesting the statement<BR><BR>IF (a(0,0)==today) THEN<BR> IF(a(0,1)==actualmonth) THEN<BR> rowcolor="#C0C0C0"<BR> end if<BR>end if<BR><BR>Hope this helps<BR>Pauline

5. Junior Member
Join Date
Dec 1969
Posts
8

## RE: compare variables?

Thanks for your effort but it dosen&#039t work either.<BR><BR>I think the problem somehow are when I&#039m trying to put<BR>variables in the statement as:<BR><BR>IF a(0,1)=var1 AND a(0,0)=var2 Then<BR> rowcolor="#BBFFD3"<BR> End If<BR><BR>The following code works just fine, but it don&#039t make the page<BR>very dynamic:<BR>IF a(0,1)="03" AND a(0,0)="May" Then<BR> rowcolor="#BBFFD3"<BR> End If<BR><BR>Double quotes are javascript-operators, and I&#039m working<BR>with VBScript.<BR><BR>So I don&#039t know what to do.<BR><BR>Milo<BR><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
•