Ask Your Question

Function that returns an array values

asked 2016-11-30 12:21:23 +0200

Iniziato gravatar image

Hello! I would like to writer in Calc (macro) a function, which result is an array of values

function array(input data)


array(1) = ... array(2) = .... array(3) = ....

end function

Is it possible, in your opinion? :-)

Thank you

Best Regards

SO Windows 7 - Windows 10 SW Libreoffice 5.2.3

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-11-30 15:16:32 +0200

pierre-yves samyn gravatar image

updated 2016-12-01 08:22:29 +0200


It is possible...


Confirm entry using the key combination Ctrl+Shift+Enter


You can call the function from another procedure, eg.:

Sub Main

dim lMyValues(1) as long, lOneValue as long

lMyValues = MyArray(2310)

for each lOneValue in lMyValues
    print lOneValue 
next lOneValue 

End Sub

function MyArray(lValue as long)
MyArray = array(lValue * 2, lValue * 3)
end function


edit flag offensive delete link more


Well Done Thank you Pierre :-) If I want To pass this values to another function in StarBasic, it is Always possible?

Iniziato gravatar imageIniziato ( 2016-11-30 18:29:10 +0200 )edit

See my edit in my answer...

pierre-yves samyn gravatar imagepierre-yves samyn ( 2016-12-01 08:23:27 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-11-30 12:21:23 +0200

Seen: 1,592 times

Last updated: Dec 01 '16