Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function Problem 2

Status
Not open for further replies.

marabozu

Programmer
Jan 3, 2001
36
US
I want a function that returns a vector, does anyone knows how?
I've tried in several ways, but none of them seams to work.

1:
Function vector(a)
Dim f_vector(10)
f_vector(0) = a
f_vector(1) = a+1
f_vector(2) = a+10
vector = f_vector
End function

call vector(2)
response.write vector(1) 'of course that does'n work

then I tried

Function vector(a)
Dim f_vector(10)
f_vector(0) = a
f_vector(1) = a+1
f_vector(2) = a+10
vector = f_vector
End function

Dim The_Vector(10)
The_Vector = vector(a)
response.write The_Vector(1) 'This doesn't work to!!

I appreciate any help, thank you

Miguel
 
would u like to tell what do u mean by 'vector'. is it mathematical vector or something else? then i might help u.

computerjin
 
computerjin,

in this case what I mean by vector is the same as an array. So I want a function that returns an array with a set o values.

Thank you for you attention

Miguel
 
try this one..

Function vector(a)
Dim f_vector
'' redim this variable to use as an array
redim f_vector(2)
f_vector(0) = a
f_vector(1) = a+1
f_vector(2) = a+10
vector = f_vector
End function
then u can use value return by vector to any varient.
for example.
dim x
x=vector(10)
msgbox cstr(x(2))

actually only a varient can be returned by a function and Also u can use varient as an array.
Anil.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top