Jump to content

String prepend: Difference between revisions

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}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.