Hacker News new | ask | show | jobs
by pvg 2832 days ago
Isn't that just someone putting some weird thing in some oddball BASIC implementation? I don't think any of the popular ones did anything like that.
1 comments

Some of them allowed to use MID$ for the left-hand side of an assignment to replace a substring, which is also unexpected.
MID$ still took a string as an argument, though, right?
That syntax was irregular but very useful. It was not surprising or confusing.

A$ = "ABCD"

MID(A$,2,2)="12"

PRINT $A

>A123

Assuming a typo here, but I would be surprised if the output contained "3"
This is still going strong today in list slice notation in Python (and other languages, no doubt):

    x = [1,2,5,6]
    x[2:2] = [3,4]
    print(x)
(Slice notation can be used on any collection, not just lists, but you can't use it in assignment like that for strings because they're immutable, so you'd have to convert to a list of characters and back.)