Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Meaning of Numbers 1

Status
Not open for further replies.

glenmac

Technical User
Jul 3, 2002
947
CA
I got some code from a earlier post and can understand everything that is happening except one thing. Can anyone shead some lite on my dull mind. Here's a code snippet of what I don't understand.
Code:
    if varType(arrOrders) < 8192 then
      arrOrders = session(&quot;arrOrders&quot;)
    end if
   if varType(arrOrders) > 8191 then
I don't understand what the numbers in the code mean. I think it's asci????
 
I would say the numbers are just that - numbers, obviously predefined for that piece of code, you could say < 1000 if you wanted to check if the contents of the array was less than one thousand.
e.g.

varType(1) = 1000
varType(2) = 500 etc

varType(1) doesnt fulfil the condition of < 1000
varType(2) does fulfil the condition of < 1000

:O) Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Acvtually varType is a function that return the type of variable you give it. 8192 is the constant that means type array. So in this case you are checking before hand if it is not an array (all other type constants are less than array type constant).
Here is a link to a table of type constants in case I was to confusing :b

-Tarwn &quot;If you eat a live toad first thing in the morning, nothing worse will happen all day long.&quot; - California saying
&quot;To you or the toad&quot; - Niven's restatement of California saying
&quot;-well most of the time anyway...&quot; - programmers caveat to Niven's restatement of California saying
(The Wiz Biz - Ri
 
Thanks Taewin . You've come to my rescue again!!
 
Although Tawrn would checking an array this way be more efficient?

Code:
If IsArray(MyArray) then
'is array..
   Else
'isnt an array
End if
www.vzio.com
ASP WEB DEVELOPMENT



 
I don't know which is more efficient, I would actually think the varType function would be just as efficient because I am betting that the IsArray method simply does the If varType(variable) = 8192 Then ...
Using varType accesses the actual type property of the variable which is on a much lower level of processing than the IsArray since that numeric code is actually used by the scripting engine internally to define it as type array.
So in summation, to confuse the reader even more, I would expect that varType is more efficient because IsArray most likely makes a call to it itself.

Any function is generally more efficient than the function that calls it.
-Tarwn &quot;If you eat a live toad first thing in the morning, nothing worse will happen all day long.&quot; - California saying
&quot;To you or the toad&quot; - Niven's restatement of California saying
&quot;-well most of the time anyway...&quot; - programmers caveat to Niven's restatement of California saying
(The Wiz Biz - Ri
 
so much detail tarwn, how do you ever getting anything done??? ;p

www.vzio.com
ASP WEB DEVELOPMENT



 
I am actually a four-armed alien bent on taking over the world starting with ASP programmers [wink]

-Tarwn &quot;If you eat a live toad first thing in the morning, nothing worse will happen all day long.&quot; - California saying
&quot;To you or the toad&quot; - Niven's restatement of California saying
&quot;-well most of the time anyway...&quot; - programmers caveat to Niven's restatement of California saying
(The Wiz Biz - Ri
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top