![]() |
Forum Index : Microcontroller and PC projects : CMM2: Can functions return an array?
Author | Message | ||||
johnd Newbie ![]() Joined: 22/10/2020 Location: United StatesPosts: 30 |
Just wondering if functions can return an array? I know functions and subs can be passed in an array and that can be altered, which is fine by me. But I'm just wondering if I'm missing something, and I'd like to be consistent between subs and functions if possible. I've tried function xxx(x%, y%) local integer a(2) a(0) = x% a(1) = y% xxx = a end function but no go. Just curious. Thanks, johnd |
||||
mkopack73 Senior Member ![]() Joined: 03/07/2020 Location: United StatesPosts: 261 |
Not that I’m aware... |
||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
Where is declared the return from this function? Maybe: function xxx(x%, y%) as integer local integer a(2) a(0) = x% a(1) = y% xxx = a end function Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4301 |
You cannot return arrays from functions. Regards, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
johnd Newbie ![]() Joined: 22/10/2020 Location: United StatesPosts: 30 |
@thwill: That is what I thought, but asked just in case. I'll just use subroutines and pass in the return array as an argument to be filled out within the subroutine. Thanks. ![]() |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |