String prepend: Difference between revisions

Content deleted Content added
Lingo added
PureFox (talk | contribs)
Added FreeBASIC
Line 392:
===Modern===
With F90, and standardised in F2003, came extensions that enable a variable to be "cut-to-fit" on each usage. The first assignment would discard any storage associated with TEXT and re-assign space matching the size of the expression's result, so TEXT would have six characters. In the next statement, the expression would be evaluated and produce twelve characters (six from "Hello ", and the six of the current size of TEXT), then the current storage for text would be discarded and TEXT re-allocated to be of size twelve. At some cost in overhead. On the other hand, rather than copy the result of an expression from the scratchpad to the recipient, with re-allocation, the recipient variable could be repointed to the result area: no copying needed.
 
=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64
 
Var s = "prepend"
s = "String " + s
Print s
Sleep</lang>
 
{{out}}
<pre>
String prepend
</pre>
 
=={{header|Go}}==