String concatenation: Difference between revisions

Corrected BASIC and AppleSoft BASIC - Semicolons are not concatenation operators, they suppress newlines and work only on PRINT statements.
(Corrected BASIC and AppleSoft BASIC - Semicolons are not concatenation operators, they suppress newlines and work only on PRINT statements.)
Line 312:
{{works with|Liberty BASIC}}
<lang qbasic>s$ = "hello"
print s$;" literal" 'or s$ + " literal"
s2$ = s$ + " literal"
print s$
print s2$</lang>
{{out}}
<pre>hello literal
hello
hello literal</pre>
 
==={{header|Applesoft BASIC}}===
 
<lang ApplesoftBasic>S$ = "HELLO"
A semicolon (;) is ''not'' the same as a concatenate operator (+), it is an instruction that works only on the <code>PRINT</code> statement to suppress newlines at the end of a literal or series of literals. For example, the instruction <code>S$="HELLO";"LITERAL"</code> would result in a syntax error.
PRINT S$;" LITERAL" :REM OR S$ + " LITERAL"
 
S2$ = S$ + " LITERAL"
<lang ApplesoftBasic>10 S$ = "HELLO"
PRINT S2$</lang>
20 PRINT S$;" LITERAL" :REM OR S$ + " LITERAL"
30 PRINT S$
40 S2$ = S$ + " LITERAL"
50 PRINT S2$</lang>
 
{{out}}
<pre>HELLO LITERAL
HELLO
HELLO LITERAL</pre>
 
==={{header|BaCon}}===
113

edits