String concatenation: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
(Add Zig example)
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 118:
display dialog totMsg
end try</lang>
 
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
Line 205 ⟶ 206:
 
<pre>Hello World!</pre>
 
 
=={{header|AutoHotkey}}==
Line 310:
}</lang>
 
=={{header|ChucKC sharp|C#}}==
<lang csharp>using System;
 
"Hello" => string A;
class Program {
A + " World!" => string B;
static void Main(string[] args) {
<<< B >>>;
var s = "hello";
</lang>
Console.Write(s);
{{out}}
Console.WriteLine(" literal");
<pre>"Hello World!"</pre>
var s2 = s + " literal";
Console.WriteLine(s2);
}
}</lang>
 
=={{header|C++}}==
<lang cpp>#include <string>
Line 333 ⟶ 338:
hello literal</pre>
 
=={{header|C sharp|C#ChucK}}==
<lang csharp>using System;
"Hello" => string A;
 
A + " World!" => string B;
class Program {
<<< B >>>;
static void Main(string[] args) {
</lang>
var s = "hello";
{{out}}
Console.Write(s);
<pre>"Hello World!"</pre>
Console.WriteLine(" literal");
var s2 = s + " literal";
Console.WriteLine(s2);
}
}</lang>
 
=={{header|Clojure}}==
Line 426 ⟶ 427:
:> Hello world
</pre>
 
=={{header|D}}==
<lang d>import std.stdio;
Line 435 ⟶ 437:
writeln(s2);
}</lang>
 
=={{header|DCL}}==
<lang DCL>$ string1 = "hello"
Line 456 ⟶ 459:
WriteLn(s2);
end.</lang>
=={{header|Déjà Vu}}==
<lang dejavu>local :s1 "hello"
local :s2 concat( s1 ", world" )
!print s2</lang>
{{out}}
<pre>hello, world</pre>
 
=={{header|DWScript}}==
Line 500 ⟶ 497:
 
end class</lang>
 
=={{header|Déjà Vu}}==
<lang dejavu>local :s1 "hello"
local :s2 concat( s1 ", world" )
!print s2</lang>
{{out}}
<pre>hello, world</pre>
 
=={{header|EasyLang}}==
Line 606 ⟶ 610:
hello literal
hello literal
 
 
=={{header|Excel}}==
Line 622 ⟶ 625:
Hello World Hello World
</lang>
 
 
=={{header|F_Sharp|F#}}==
Line 639 ⟶ 641:
=={{header|Factor}}==
<lang factor>"wake up" [ " sheeple" append print ] [ ", you sheep" append ] bi print</lang>
 
 
=={{header|Falcon}}==
Line 839 ⟶ 840:
# to suppress the string quotation marks
hello there!
 
=={{header|Julia}}==
<lang julia>s = "hello"
Line 881 ⟶ 883:
<lang lang5>: concat 2 compress "" join ;
'hello " literal" concat</lang>
 
 
=={{header|Lasso}}==
Line 956 ⟶ 957:
CheckString
</lang>
 
=={{header|M4}}==
M4 has macros rather than variables, but a macro expanded can work like a variable.
<lang m4>define(`concat',`$1$2')dnl
define(`A',`any text value')dnl
concat(`A',` concatenated with string literal')
define(`B',`concat(`A',` and string literal')')dnl
B</lang>
 
=={{header|Maple}}==
Line 990 ⟶ 999:
sconcat(s, " ", t);
/* "the quick brown fox jumps over the lazy dog" */</lang>
 
=={{header|MAXScript}}==
<lang maxscript>s = "hello"
print (s + " literal")
s1 = s + " literal"
print s1</lang>
 
=={{header|Mercury}}==
Line 1,006 ⟶ 1,021:
io.write_string(S, !IO), io.nl(!IO),
io.write_string(S1, !IO), io.nl(!IO).</lang>
 
=={{header|Metafont}}==
<lang metafont>string a, b;
a := "String";
message a & " literal";
b := a & " literal";
message b;</lang>
 
=={{header|min}}==
Line 1,025 ⟶ 1,047:
{{output}}
<pre>hello world!</pre>
 
=={{header|MUMPS}}==
<lang MUMPS>STRCAT
SET S="STRING"
WRITE !,S
SET T=S_" LITERAL"
WRITE !,T
QUIT</lang>
{{out}}
<pre>
CACHE>D STRCAT^ROSETTA
STRING
STRING LITERAL
</pre>
 
=={{header|M4}}==
M4 has macros rather than variables, but a macro expanded can work like a variable.
<lang m4>define(`concat',`$1$2')dnl
define(`A',`any text value')dnl
concat(`A',` concatenated with string literal')
define(`B',`concat(`A',` and string literal')')dnl
B</lang>
 
=={{header|MAXScript}}==
<lang maxscript>s = "hello"
print (s + " literal")
s1 = s + " literal"
print s1</lang>
 
=={{header|Metafont}}==
<lang metafont>string a, b;
a := "String";
message a & " literal";
b := a & " literal";
message b;</lang>
 
=={{header|Modula-3}}==
Line 1,078 ⟶ 1,064:
Modula-3 also provides modules for dealing with <code>TEXT</code>s, such as <code>Text</code>.
<lang modula3>string1 := Text.Concat(string, " literal.\n");</lang>
 
=={{header|MUMPS}}==
<lang MUMPS>STRCAT
SET S="STRING"
WRITE !,S
SET T=S_" LITERAL"
WRITE !,T
QUIT</lang>
{{out}}
<pre>
CACHE>D STRCAT^ROSETTA
STRING
STRING LITERAL
</pre>
 
=={{header|Nanoquery}}==
Line 1,296 ⟶ 1,297:
<lang perl>$s .= ' literal';
print $s, "\n";</lang>
 
=={{header|Perl 6}}==
{{works with|Rakudo|#22 "Thousand Oaks"}}
<lang perl6>my $s = 'hello';
say $s ~ ' literal';
my $s1 = $s ~ ' literal';
say $s1;
 
# or, using mutating concatenation:
 
$s ~= ' literal';
say $s;</lang>
Note also that most concatenation in Perl 6 is done implicitly via interpolation.
 
=={{header|Phix}}==
Line 1,433 ⟶ 1,421:
; hello
; hello world!</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
{{works with|Rakudo|#22 "Thousand Oaks"}}
<lang perl6>my $s = 'hello';
say $s ~ ' literal';
my $s1 = $s ~ ' literal';
say $s1;
 
# or, using mutating concatenation:
 
$s ~= ' literal';
say $s;</lang>
Note also that most concatenation in Perl 6 is done implicitly via interpolation.
 
=={{header|Raven}}==
Line 1,470 ⟶ 1,472:
>> print str1
Hello World</lang>
 
=={{header|Retro}}==
<lang Retro>
'hello_ 'literal s:append s:put</lang>
 
=={{header|REXX}}==
Line 1,481 ⟶ 1,487:
say genus"berry" /* This outputs strawberry */
say genus || "berry" /* Concatenation using a doublepipe does not cause spaces */</lang>
 
=={{header|Retro}}==
<lang Retro>
'hello_ 'literal s:append s:put</lang>
 
=={{header|Ring}}==
Line 1,570 ⟶ 1,572:
-->s2
Hello world! </pre>
 
 
=={{header|Seed7}}==
Line 1,598 ⟶ 1,599:
<lang ruby>s += ' literal';
say s;</lang>
 
=={{header|Simula}}==
<lang Simula>TEXT PROCEDURE concatenate(head, tail);
Line 1,743 ⟶ 1,745:
print(s2);
}</lang>
 
=={{header|Visual Basic}}==
{{works with|Visual Basic|VB6 Standard}}
works the same as in VBA, see [[String_concatenation#VBA]]
 
=={{header|Visual Basic .NET}}==
'''Platform:''' [[.NET]]
{{works with|Visual Basic .NET|9.0+}}
<lang vbnet>s = "Hello"
Console.WriteLine(s & " literal")
s1 = s + " literal"
Console.WriteLine(s1)</lang>
 
=={{header|VBA}}==
Line 1,776 ⟶ 1,766:
Rosetta code!
Rosetta code... based on concatenation of : Rosetta and code...</pre>
 
=={{header|Visual Basic}}==
{{works with|Visual Basic|VB6 Standard}}
works the same as in VBA, see [[String_concatenation#VBA]]
 
=={{header|Visual Basic .NET}}==
'''Platform:''' [[.NET]]
{{works with|Visual Basic .NET|9.0+}}
<lang vbnet>s = "Hello"
Console.WriteLine(s & " literal")
s1 = s + " literal"
Console.WriteLine(s1)</lang>
 
=={{header|Wee Basic}}==
10,343

edits