Menu

Can Functions return Arrays?

Anonymous
2021-12-01
2021-12-17
  • Anonymous

    Anonymous - 2021-12-01

    What the topic says. If that's true and I am not missing something, all arrays need to be global.

     
  • Christos

    Christos - 2021-12-01

    Also (that was I btw, I thought I was logged in), arrays are not dynamic so I can't just dim an array and then push more values. Correct?

     
    • Anonymous

      Anonymous - 2021-12-17

      DIM also redimensions, a la C's realloc() or MS BASIC'S REDIM PRESERVE.

      Use LOCAL to declare an array within a function or procedure.

      I don't think X11 Basic was designed to be a "functional" language like LISP or LOGO. You might be able to get close by abusing strings or creating your own list arena in a global dynamic array, kind of like how 1983 Atari LOGO did its memory management.

       
  • Markus Hoffmann

    Markus Hoffmann - 2021-12-02

    Well, you can at least put the array as "by reference" in the parameter list. (See the VAR statement). This way your subroutine can modify the array content.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.