Micro Focus QTP (UFT) Forums
Can we declare an array without using parenthesis ? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Can we declare an array without using parenthesis ? (/Thread-Can-we-declare-an-array-without-using-parenthesis)



Can we declare an array without using parenthesis ? - Aarush.click - 01-03-2013

Hi , I found an VB script program on a site

Code:
Dim MyString, MyArray, Msg
MyString = "VBScriptXisXfun!"
MyArray = Split(MyString, "x", -1, 1)
' MyArray(0) contains "VBScript".
' MyArray(1) contains "is".
' MyArray(2) contains "fun!".
Msg = MyArray(0) & " " & MyArray(1)
Msg = Msg   & " " & MyArray(2)
MsgBox Msg

in this program MyArray is a variable as it is not declared with the parenthesis.
then how this program is working ?
Can we declare an array without parenthesis ?

Please help me Smile


RE: Can we declare an array without using parenthesis ? - Ankesh - 01-03-2013

MyArray = Split(MyString, "x", -1, 1)


Split is a function which which will split a variable using the delimeter and returns an array. Here Mystring is being split using x and it is returning an array which is being stored in MyArray. Please read more about split in QTP Help file.

Regards,
Ankesh


RE: Can we declare an array without using parenthesis ? - Aarush.click - 01-03-2013

Thanks a lot Ankesh for ur quick response.. Smile