String interpolation (included): Difference between revisions
Content added Content deleted
(Adds slope example) |
|||
Line 2,000: | Line 2,000: | ||
set fun3 {aNd]} |
set fun3 {aNd]} |
||
puts [subst "$grandpa $fun1$[subst $$fun2] $fun3 $grandma"]</syntaxhighlight> |
puts [subst "$grandpa $fun1$[subst $$fun2] $fun3 $grandma"]</syntaxhighlight> |
||
=={{header|Transd}}== |
|||
<syntaxhighlight lang="Scheme">#lang transd |
|||
MainModule: { |
|||
size: "little", |
|||
_start: (λ |
|||
// Transd supports direct interpolation |
|||
(with s String("Mary had a " size " lamb.") |
|||
(lout s)) |
|||
// To interpolate a string variable within another |
|||
// string variable we use 'replace' |
|||
(with s "Mary had a %s lamb." |
|||
(lout (replace s "%s" size))) |
|||
) |
|||
}</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
Mary had a little lamb. |
|||
Mary had a little lamb. |
|||
</pre> |
|||
=={{header|TUSCRIPT}}== |
=={{header|TUSCRIPT}}== |