Copy a string: Difference between revisions
Content added Content deleted
(Copy a string en Asymptote) |
|||
Line 1,920: | Line 1,920: | ||
<lang php>$src = "Hello"; |
<lang php>$src = "Hello"; |
||
$dst = $src;</lang> |
$dst = $src;</lang> |
||
=={{header|Picat}}== |
|||
Use <code>copy_term/1</code> to ensure that the original string is not changed. |
|||
<lang Picat>go => |
|||
S1 = "string", |
|||
println(s1=S1), |
|||
S2 = S1, |
|||
S2[1] := 'x', % also changes S1 |
|||
println(s1=S1), |
|||
println(s2=S2), |
|||
nl, |
|||
S3 = "string", |
|||
S4 = copy_term(S3), |
|||
S4[1] := 'x', % no change of S3 |
|||
println(s3=S3), |
|||
println(s4=S4), |
|||
nl.</lang> |
|||
{{out}} |
|||
<pre>s1 = string |
|||
s1 = xtring |
|||
s2 = xtring |
|||
s3 = string |
|||
s4 = xtring</pre> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |