从vbscript中的函数返回一个二维数组 [英] returning a two dimensional array from a function in vbscript
问题描述
我试图做的是有一个函数接受来自用户的输入,并将该数据存储在数组
中用于小型测试目的,它是一个3 x 3数组
i获得了数组功能通过回显存储的所有值来进行测试。
然而,当我试图返回数组到它从它被称为我得到不匹配的错误,即时通讯不知道我在做什么错。
<$ p $ ()
Array = GetInfo()
End Sub
函数GetInfo()
Dim FunctionArray(2,2)
{将所有数据输入到数组中}
GetInfo = FunctionArray()
End Function
任何我能得到的帮助都会很棒,因为这对我来说是新的。
Cheran Shunmugavel指向正确的方向,但他的解释包含了一个模糊的问题。要明确:
Sub SubroutineA()
Dim Arr'<<< --- do不使用括号,也不使用
'保留关键字Array
Arr = GetInfo()
End Sub
函数GetInfo()
Dim FunctionArray(2,2)
'{将所有数据输入到数组中}
GetInfo = FunctionArray'<<< ---在这里不使用圆括号
End Function
im having an issue with a program im working on. what im trying to do is have a function accept input from a user and store that data in an array for small testing purposes it is a 3 x 3 array i have gotten the array within the function to work as tested by echoing out all values stored. however when i attempt to return the array to the sub from which it is called i get mismatch errors, im not sure what i am doing wrong.
Sub SubroutineA()
Dim Array(2,2)
Array = GetInfo()
End Sub
Function GetInfo()
Dim FunctionArray(2,2)
{input all data into array}
GetInfo = FunctionArray()
End Function
Any Help i could get would be great as this is new to me.
Cheran Shunmugavel points to the right direction, but his explanation contains an ambiguety. To make it clear:
Sub SubroutineA()
Dim Arr ' <<<--- do not use parenthesis here and do not use
' the reserved keyword "Array"
Arr = GetInfo()
End Sub
Function GetInfo()
Dim FunctionArray(2,2)
' {input all data into array}
GetInfo = FunctionArray ' <<<--- do not use parenthesis here
End Function
这篇关于从vbscript中的函数返回一个二维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!