...

View Full Version : Resolved if elseif then... number within range...



haaid
01-07-2009, 02:16 PM
Hi,

I'm trying to code a calculation which checks if a number (number of days) is


equal to 1
bigger than 1 but lower than 8 (2 to 7)
bigger than 7 but lower than 14 (8-13)
bigger than 14

there would be a response then depending on what category the result is...

i had thought to do this with


<%if number = 1 then
response.write("1")
elseif 1 < number < 8 then
response.write("more than one, less than 7")
elseif 7 < number < 14 then
response.write("more than 7, less than 14")
elseif number > 14 then
response.write("more than 14")
end if
%>

but that doesn't seem to do it. Hints and pointers welcome...
and yes, i'm a novice :-)

abduraooft
01-07-2009, 02:32 PM
elseif 1 < number < 8 then Don't know much about ASP, but I think the above should be

elseif 1 < number And number < 8 then
(similarly for the other one)

haaid
01-07-2009, 02:46 PM
that solved it!

Thank you.

Spudhead
01-07-2009, 05:47 PM
Or...


select case true
case number = 1
' do stuff
case number > 1 and number < 8
' do stuff
case number > 7 and number < 14
' do stuff
case number > 14
' do stuff
end select

angst
01-07-2009, 07:35 PM
being ASP you may also want to cast your values as integers
cint(number)

ASP is picky about data types.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum