Anonymous user
String prepend: Difference between revisions
→{{header|Icon}} and {{header|Unicon}}, update to show a method to only reference s once in the prepend
m (→{{header|Stata}}: +SML) |
|||
Line 618:
<lang unicon>s := "world!"
s := "Hello, " || s</lang>
To demonstrate how this could be done with only one reference to the variable during the prepend:
<lang unicon>procedure main()
s := ", world"
s[1:1] ||:= "Hello"
write(s)
end</lang>
{{out}}
<pre>prompt$ unicon -s prepend.icn -x
Hello, world</pre>
=={{header|J}}==
|