Code: Select all
10 DIM p(1)
20 p() += 1,2
Code: Select all
30 p() = 1,2
40 p() += 1
Code: Select all
10 DIM p(1)
20 p() += 1,2
Code: Select all
30 p() = 1,2
40 p() += 1
The way all my BASICs (BB4W, BBCSDL, BBCZ80) implement this is effectively:
Code: Select all
array() <operator> <array-expression>
BBC BASIC isn't great on "formal definitions" because it's largely documented informally. The closest there is in Acorn's documentation is this:Does the formal definition of the syntax for += in BASIC V allow for multiple parameters? I can't find this, despite having the PRMs and user guides....
Code: Select all
array = factor, expression, ... Set several elements
array += expression
That's not true of my BASICs: X += 1, where X was not previously defined, will set X to 1, it won't raise an error. I agree that might suggest that internally the simple assignment and compound assignment operations in Acorn's BASICs are quite separate, whereas in my BASICs they share the same code.it says of the newly-introduced += that saying X = X+1 is sufficient to declare a variable X with value 0, while X += 1 will NOT do so, and will throw a syntax error.