Path: csiph.com!aioe.org!U/KX8ba/OMuTXW5s0P7Tsg.user.46.165.242.75.POSTED!not-for-mail From: Paul Stewart Newsgroups: comp.sys.acorn.programmer Subject: Re: Arrays in BASIC Date: Sun, 02 Jan 2022 22:18:33 GMT Organization: Aioe.org NNTP Server Lines: 47 Message-ID: <6cc2afa459.Paul@outlook.com> References: <3261a6a459.Paul@outlook.com> <65baa8a459.harriet@bazleyfamily.co.uk> <12c0ada459.Paul@outlook.com> Injection-Info: gioia.aioe.org; logging-data="57890"; posting-host="U/KX8ba/OMuTXW5s0P7Tsg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Messenger-Pro/8.05wpb1 (RemoteNB/3.13) (RISC-OS/4.42) X-Notice: Filtered by postfilter v. 0.9.2 X-Editor: EmailEdit 2.04 Xref: csiph.com comp.sys.acorn.programmer:6306 In message <12c0ada459.Paul@outlook.com> Paul Stewart wrote: > In message <65baa8a459.harriet@bazleyfamily.co.uk> > Harriet Bazley 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