Can you iterate the values of an array that is stored as an item in a scripting.dictionary object? -
i returned values given code.
wscript.stdout.writeline "what favorite word? " wordreply = wscript.stdin.readline wscript.stdout.writeline "enter number: " num1 = cint(wscript.stdin.readline) wscript.stdout.writeline "enter number: " num2 = cint(wscript.stdin.readline) wscript.stdout.writeline "enter number: " num3 = cint(wscript.stdin.readline) wscript.stdout.writeline "enter number: " num4 = cint(wscript.stdin.readline) wscript.stdout.writeline "enter number: " num5 = cint(wscript.stdin.readline) newword = wordreply set wordreply = new createobject("scripting.dictionary") wordreply.add newword, array(num1, num2, num3, num4, num5) i want return or display using wscript.stdout.writeline values prompted inside array keyed under newword item of wordreply. can done successfully? have seen numerous examples of how iterate through scripting dictionary object never through array inside of value of scripting object.
if dictionary d contains array (1, 2, 3) under/for key ("aword"), d("aword") gives a copy of array, can treated every array in vbscript. evidence:
>> set d = createobject("scripting.dictionary") >> d("aword") = array(1, 2, 3) >> wscript.stdout.writeline join(d("aword"), "-") >> 1-2-3 >> if insist on iterating:
>> = 0 ubound(d("aword")) >> wscript.echo d("aword")(i) >> next >> 1 2 3
Comments
Post a Comment