String prepend: Difference between revisions

simplify →‎Pascal
No edit summary
(simplify →‎Pascal)
Line 862:
String prepend
</pre>
 
=={{works withheader|Free Pascal|2.6.2}}==
Free Pascal supports everything shown in [[#Pascal|§ Pascal]] (except the <tt>string</tt> schema data type, <tt>string(20)</tt> must be written like here).
Furthermore, using the compiler directive <tt>{$COperators}</tt> the following is possible, too:
<lang delphi>var
line: string[20];
begin
line := 'Hello ';
{$COperators on}
line += 'world!';
writeLn(line)
end.</lang>
 
=={{header|Gambas}}==
Line 1,197 ⟶ 1,209:
 
=={{header|Pascal}}==
''See also [[#Free Pascal|Free Pascal]]''
{{works with|Extended Pascal}}
 
<lang pascal>program stringPrepend(output);
{{works with|Free Pascal|2.6.2}}
 
<lang Pascal>program StringPrepend;
{$mode objfpc}{$H+}
 
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
 
var
line: string(20);
s: String = ' World !';
begin
s line := 'Hello ' + s;
line := line + 'world!';
WriteLn(S);
writeLn(line);
ReadLn;
line := 'Hello ';
writeStr(line, line, 'world!');
writeLn(line)
end.</lang>
{{out}}
<pre>Hello World world!</pre>
Hello world!</pre>
 
=={{header|Perl}}==
149

edits