[thelist] declaring once verse not

Gary Swanson gswanson at daystarinc.com
Thu Aug 14 08:33:49 CDT 2003


I have online app that is looking at the current month and determining what
quarter it is.  IE Q3

I am doing this with a simple else if

curmonth = month(date())

if curmonth >=1 AND curmonth<4 then
    currentquarter = "Q1"
elseif curmonth>=4 AND curmonth<7 then
    currentquarter = "Q2"
elseif curmonth>=7 AND curmonth<10 then
    currentquarter = "Q3"
elseif curmonth>=10 AND curmonth<=12 then
    currentquarter = "Q4"
end if

This got me wondering ... does it take less processor usage to set a
variable once and call it everytime, or to just repeat the month function
for each use.
1.
curmonth = month(date())
    check curmonth
    check curmonth
    check curmonth
2.
    check month(date())
    check month(date())
    check month(date())

Though there is probably no great difference in this one use, would it add
up if one style is used alot over another?

Any ideas?

TIA



More information about the thelist mailing list