Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11918

Re: Variable type questions

From "R.Wieser" <address@not.available>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Variable type questions
Date 2018-04-27 09:38 +0200
Organization Aioe.org NNTP Server
Message-ID <pbuk16$9oj$1@gioia.aioe.org> (permalink)
References <swdf41oi1p7r$.1s7t32djqg8xd.dlg@40tude.net>

Show all headers | View raw


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

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Variable type questions JJ <jj4public@vfemail.net> - 2018-04-27 02:16 +0700
  Re: Variable type questions "Mayayana" <mayayana@invalid.nospam> - 2018-04-26 17:17 -0400
    Re: Variable type questions JJ <jj4public@vfemail.net> - 2018-04-28 02:44 +0700
  Re: Variable type questions "R.Wieser" <address@not.available> - 2018-04-27 09:38 +0200
    Re: Variable type questions JJ <jj4public@vfemail.net> - 2018-04-28 02:56 +0700
  Re: Variable type questions "Roger Roesler" <worm.composter@nospam.arcornews.de> - 2018-04-29 11:35 +0200
    Re: Variable type questions JJ <jj4public@vfemail.net> - 2018-04-29 22:51 +0700
      Re: Variable type questions "Roger Roesler" <worm.composter@nospam.arcornews.de> - 2018-04-29 19:54 +0200

csiph-web