String prepend: Difference between revisions

Content added Content deleted
Line 624: Line 624:
s := ", world"
s := ", world"
s[1:1] ||:= "Hello"
s[1:1] ||:= "Hello"
write(s)
end</lang>

{{out}}
<pre>prompt$ unicon -s prepend.icn -x
Hello, world</pre>

Another take on it, using String Scanning:

<lang unicon>procedure main()
(s := ", world") ?:= "Hello" || tab(0)
write(s)
write(s)
end</lang>
end</lang>