Hi guys,10 PROCarray
Need to pick you brains on Arrays.
Looking at Arrays in the Archimedies User Guide (vintage July 1987), I
have come to the understanding that it is possible to declare an array
local to a function or procedure. Having tried to do this, I keep getting Syntax Error.
I am trying using: LOCAL DIM a$(1,1)
Also tried different permutations, but all come back with Syntax error.
Am I barking up the wrong tree here or just completely misunderstanding
the examples provided?
Any advice examples you can give, much appreciated.
L.
RUNarray hat
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
RUNarray hat
Undimensioned array at line 16
On 2 Jan 2022 as I do recall,
Paul Stewart wrote:
Need to pick you brains on Arrays.
Looking at Arrays in the Archimedies User Guide (vintage July
1987),
You should download the BASIC manual from https://www.riscosopen.org/content/downloads/common
which is *much* more up to date!
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
RUNarray 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.
On 2 Jan 2022 as I do recall,
Martin wrote:
You should download the BASIC manual from https://www.riscosopen.org/content/downloads/common
which is *much* more up to date!
There's certainly stuff in there about arrays that I had no idea
about - I don't know if that's because it's genuinely new since
1987, or because I never attempted whole-array operations....
10 DIM A(2,2)
60 A() += n%*n%
equates to "square the variable n% and increase each and every
element in the array A() by the result of that calculation"
On 2 Jan 2022 as I do recall,
Martin wrote:
You should download the BASIC manual fromThere's certainly stuff in there about arrays that I had no idea about -
https://www.riscosopen.org/content/downloads/common
which is *much* more up to date!
I don't know if that's because it's genuinely new since 1987, or because
I never attempted whole-array operations....
10 DIM A(2,2)
60 A() += n%*n%
equates to "square the variable n% and increase each and every element
in the array A() by the result of that calculation"
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 185 |
Nodes: | 16 (1 / 15) |
Uptime: | 57:16:55 |
Calls: | 3,747 |
Files: | 11,167 |
Messages: | 3,458,008 |