01-03-2021, 01:55 AM
In Sinclair BASIC you can DIM the length of a string using
DIM a$(5)
If I try something similar in Boriel BASIC
DIM a$(5) AS STRING
the compiler seems to interpret this as an array declaration.
Sometimes it's useful to declare the largest expected length of a string if you want to build it up of component pieces. e.g. In Sinclair BASIC:
If I try to do this in Boriel BASIC I can't declare the length, nor does it expand when needed. I seem to have to do it in two steps, one for overwriting the parts of the existing string, and a separate step to glue an addition to the end of the string.
Is this expected? Or is there a better way of building b$ from a$ in this example in only one step?
DIM a$(5)
If I try something similar in Boriel BASIC
DIM a$(5) AS STRING
the compiler seems to interpret this as an array declaration.
Sometimes it's useful to declare the largest expected length of a string if you want to build it up of component pieces. e.g. In Sinclair BASIC:
Code:
10 DIM a$="hello"
20 DIM b$(8)
30 LET b$=a$
40 LET b$(4 TO 8)="p me!"
50 PRINT b$
If I try to do this in Boriel BASIC I can't declare the length, nor does it expand when needed. I seem to have to do it in two steps, one for overwriting the parts of the existing string, and a separate step to glue an addition to the end of the string.
Code:
DIM a$, b$
a$="hello"
b$=a$
b$(3 TO 4)="p "
b$=b$+"me!"
PRINT b$
Is this expected? Or is there a better way of building b$ from a$ in this example in only one step?