View Single Post
Old 20 August 2015, 12:31   #262
Registered User

Megol's Avatar
Join Date: May 2014
Location: inside the emulator
Posts: 209
Originally Posted by Dunny View Post
Can you name a BASIC that doesn't support string concatenation with the "+" operator?
Several. In my previous post was the code from one of those (Wang 2200 BASIC), another is the (still for Wang 2200 - but for later hardware versions) BASIC-2 which used "&" for string concatenation. But there are other BASICs that doesn't support it at all or use yet another symbol/method. Sorry I don't remember the names right now - it was ages ago I used them.
I guess most modern BASICs support "+" for concatenation as it would ease porting from Visual BASIC?

In the original Dartmouth BASIC (and indeed any BASIC), the PRINT command requires one of two things as a print-item - either a print separator or an expression. If your BASIC supports such things as

LET a$=b$+c$

Then PRINT will handle inline string concatenation as part of its expression evaluator.

Furthermore, I'd like to see how Blitz, using its commas to separate print items, manages to output a newline or tab? I suspect (I've not investigated though!) that it must use special characters inline in the string arguments?

Dartmouth used the semicolon for concatenation of items (both strings and numerics which by their nature cannot be concatenated using an operator without a conversion function on one of the terms), the comma for tabulation and the apostrophe for newline/carriage return. It's not a "hack", but I agree that it's the only command that uses these conventions - using them with a string variable assignment wouldn't work and would break delineation of the two datatypes.
The hack I referred to would be Blitz specific _if_ it supports semicolon separators for the print statement.
BASIC use of comma/semicolon I don't think of as a hack - they are statement specific formatting specifiers. Like those of print using.

How about A:=(B=5) or A=(B==5) ?

Last edited by Megol; 20 August 2015 at 12:48.
Megol is offline  
Page generated in 0.05106 seconds with 9 queries