My math is messed up, I think.

# Thread: My math is messed up, I think.

1. Join Date
Dec 1969
Posts
41

## My math is messed up, I think.

if Session("numvisits")="" then<BR> topRight = "5525"<BR>elseif Session("numvisits") mod 3 = 0 then <BR> topRight = "eat"<BR>elseif Session("numvisits") mod 3 &#062; .5 then<BR> topRight = "bing"<BR>else<BR> topRight = "cherries"<BR>End if<BR><BR>If my math is right, I should be getting a remainder of either 0, 2/3, or 1/3, which should be giving me 0, greater than .5 and then less than .5. So I should be cycling through the different things. My variable is steadily increasing by one each time, so it should be cycling through (not necessarily in order) the three states, but I just get Bing, Bing, Eat, and no cherries. Where am I going wrong?

2. Senior Member
Join Date
Dec 1969
Posts
5,955

## The Mod statement gives you...

...the remainder after a division. Example:<BR><BR>2 mod 3 = 2<BR>3 mod 3 = 0<BR>4 mod 3 = 1<BR><BR>So, if you compare it against .5 it should always be true, unless the number is evenly divisible by 3. However, I suggest you do this instead:<BR><BR>...<BR>ElseIf Session("numvisits") mod 3 = 0 Then<BR>...<BR>ElseIf Session("numvisits") mod 3 &#062;= 1 Then<BR>...<BR><BR>Oliver.

3. Join Date
Dec 1969
Posts
41

## Thanks!

I see, I was treating it as whatever would be past the decimal point; so dividing by three would be either .33333 or .666666. Thanks, I get it!<BR><BR>(by the way, what&#039;s &#060;eop&#062; mean; end of post?)

4. Senior Member
Join Date
Dec 1969
Posts
5,955

## Yes, <eop> means "end of post". ...

...It&#039;s usually used if there&#039;s no body to the message - just a subject line. You also find "eom" for "end of message", "np" for "no post" - among other versions.<BR><BR>Oliver.

#### Posting Permissions

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