10 PRINT"ONE";:IF 1=2 THEN PRINT"TWO":PRINT"THREE"
Will print ONE on Microsoft-derived BASICs, while Dartmouth will produce ONETHREE. That is, MS treats the entire rest of the line as part of the THEN, which is... weird (and wrong IMHO).
Well, I guess there is no right or wrong, but each BASIC's own way. MS' way essentially allow the creation of a code block within a THEN clause without the need of GOTO. With Dartmouth, which works at that point like FORTRAN before, the THEN needs to jump into the code block, followed by a GOTO to get around:
20 IF 1=2 THEN GOTO 40
30 GOTO 50
Well, or use an inverted clause to jump around the code block. Neither a really great construct.
It must be noted that allowing arbitrary statements after THEN is a later add-on, not present in Dartmouth BASIC. The same goes with multiple statements separated by colon.
With MS' way of treating the whole (rest of the) line as part of the then block allows this constructs without a lot of brain jogging and gotos.
But it wasn't invented by MS, they just took it from DEC BASIC-PLUS of 1972 (After all, MS BASIC is a clone of DEC BASIC) as described on p.3-12 of the manual:
So here after a THEN multiple statements are allowed, but either executed as whole (if the condition is true) or not at all.
Now, when looking for the 'right' ways, it is usually best to first take a look BASIC standards. The first here might be
ECMA 55 Minimal BASIC of 1978
This describes the very minimum every BASIC needs to comply with to be portable. Essentially it codifies Dartmouth BASIC (Thomas Kurtz was one of the editors) in it's later incarnations in a clear and reproducible way. Here THEN statements only allow a line number to jump to.
ANSI Minimal BASIC of 1979
Essentially the ANSI version of ECMA-55.
This is BTW, the point in time were MS-BASIC started to become a normative force
ECMA 116 BASIC of 1986, also called 'Full BASIC'
Here multi statement and multi line THEN constructs and mixtures thereof are possible. Multi statement works like the 'MS way', while multi line needs an ENDIF (or ELSE/ELSEIF) statement to close the block. (It also got many other nie features known from modern BASICs, just with line numbers)
ANSI/ISO/IEC Full BASIC of 1987
Essentially ECMA-116 with a few clarifications/extensions.
So MS does follow what ECMA-116 says ... well, or better maybe the standard codifies what MS did before and thus became defacto standard. A lot of work has been put into these standards to capture a workable common place for BASIC. This includes especially edge cases of seemingly clear issues. I'd consider it best practice to check them whenever there is something open for discussion. Especially because they as well point out issues that have been not decided on/are still open to interpretation.
The example code I have would look up line 25 or the next higher statement [...]
So... does anyone know a version of BASIC that works in this fashion, or is this (as I strongly suspect) simply a bug in the example code?
I do remember a TINY BASIC that allowed to jump 'between' lines to ease computed GOTO, but looking at the original source it seams like this was a modification.
In contrast ECMA-55 states on targets used as targets in THEN/GOTO/GOSUB:
All line-numbers in control-statements shall refer to lines in the program.