Path: csiph.com!aioe.org!.POSTED!not-for-mail From: "R.Wieser" Newsgroups: microsoft.public.scripting.vbscript Subject: Re: Variable type questions Date: Fri, 27 Apr 2018 09:38:05 +0200 Organization: Aioe.org NNTP Server Lines: 59 Message-ID: References: NNTP-Posting-Host: OLAqPNFqcmhJ7HE1wtUANg.user.gioia.aioe.org X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.3 X-MSMail-Priority: Normal X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-Priority: 3 X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 Xref: csiph.com microsoft.public.scripting.vbscript:11918 JJ, > 8204 in hexadecimal is 0x200C, which is a combination of vbArray > and vbVariant. Meaning that it's an array of variants, instead of an > array of integer. So, which one is correct? The first one. Question: If you fill a(0) with 1234 and a(1) with "world", what type would the array "a" than need to be and return ? (for fun, imagine some more data types in that array: objects, booleans, floats, dates, etc. :-) ) No, the *array* is of type variant, which each *element* being of type variant too. Each of those variant elements can than ofcourse contain any type of data you please (the strong point of using variants - and ofcourse its weak point too). By the way, its posible to actually create a variant array of ints, strings or whatever, just not in VBScript* - as it only knows variants. *It can manage/move them around just fine (accepting them from and providing them to a function), it just cannot access them. > To add into the confusion, the contents of the array doesn't really > matter. > i.e. > wscript.echo vartype(a) 'still shows 8204 Have you also tried "vartype( a(0) )" ? What did you get ? In other words, this is what it looks like in VBScript: variant array (1) -> variant element (2) -> contents (3) while you are (probably) *thinking* of this : variant array -> contents You are asking what the array (at #1) is, and what its contents are. That means you are getting a result which is a combination of it (1) and its "child" (2). Nothing more, nothing less. If you want to know something about the type of the contents (at 3), you have to inquire its "parent", the variant element (at 2). And by the way, a "variant element" (as I named it in the above) is the very same thing as a "variant variable" (or "variable" for short). Hope that helps. > Also, for research purpose, there are two types that I'm unable to > produce: vbError and vbDataObject. Can't help you with that I'm afraid. Regards, Rudy Wieser