Ask Your Question
0

Function that returns an array values

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

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)

instructions

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
1

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

pierre-yves samyn gravatar image

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

Hi

It is possible...

screenshot

Confirm entry using the key combination Ctrl+Shift+Enter

[EDIT]

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

Regards

edit flag offensive delete link more

Comments

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 +0100 )edit

See my edit in my answer...

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

Question Tools

1 follower

Stats

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

Seen: 1,044 times

Last updated: Dec 01 '16