Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #6306

Re: Arrays in BASIC

From Paul Stewart <narrowboat-paul@outlook.com>
Newsgroups comp.sys.acorn.programmer
Subject Re: Arrays in BASIC
Date 2022-01-02 22:18 +0000
Organization Aioe.org NNTP Server
Message-ID <6cc2afa459.Paul@outlook.com> (permalink)
References <3261a6a459.Paul@outlook.com> <65baa8a459.harriet@bazleyfamily.co.uk> <12c0ada459.Paul@outlook.com>

Show all headers | View raw


In message <12c0ada459.Paul@outlook.com>
          Paul Stewart <narrowboat-paul@outlook.com> wrote:

> In message <65baa8a459.harriet@bazleyfamily.co.uk>
>           Harriet Bazley <harriet@bazleyfamily.co.uk> wrote:

>>>L.
>>    10 PROCarray
>>    16 PRINT D$(1)
>>    17 END


>>    20 DEF PROCarray
>>    30 LOCAL D$()
>>    40 DIM D$(7)
>>    50 D$(1)="hat"
>>    55 PRINT "array", D$(1)
>>    60 ENDPROC

>>>RUN
>> array     hat
>> Undimensioned array at line 16

> Thanks for this.  Your code works perfectly.
> Calling your PROCarray procedure twice, again works as expected.

> Trying the same in my code, "Arrays cannot be redimensioned" error.

> "Argh"

> Something in my code not not right, so will take another look.

> Thanks very much for your response.

Turns out, there were two arrays in the same procedure.
Having fixed the first one by making it local, just got fixated on that
array.  Having looked at the line number again that the error was being
reported against, it was actually the second array it was complaing about.  

Now moved dimensioning of second array out of the procedure, and all is
working as expected.

Again, thanks for your assistance with dimensioning a local array.

-- 
Paul Stewart
Sent from A9home running RISC OS 4.42

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Arrays in BASIC Paul Stewart <narrowboat-paul@outlook.com> - 2022-01-02 20:36 +0000
  Re: Arrays in BASIC Harriet Bazley <harriet@bazleyfamily.co.uk> - 2022-01-02 21:01 +0000
    Re: Arrays in BASIC Paul Stewart <narrowboat-paul@outlook.com> - 2022-01-02 21:56 +0000
      Re: Arrays in BASIC Paul Stewart <narrowboat-paul@outlook.com> - 2022-01-02 22:18 +0000
    Re: Arrays in BASIC Martin <News03@avisoft.f9.co.uk> - 2022-01-02 22:04 +0000
      Re: Arrays in BASIC Harriet Bazley <harriet@bazleyfamily.co.uk> - 2022-01-02 22:43 +0000
        Re: Arrays in BASIC Martin <News03@avisoft.f9.co.uk> - 2022-01-02 23:18 +0000
        Re: Arrays in BASIC Steve Drain <steve@kappa.me.uk> - 2022-01-03 09:46 +0000

csiph-web