RosettaCodeData/Task/String-interpolation-included-/Verbexx/string-interpolation-included-.verbexx
2023-07-01 13:44:08 -04:00

15 lines
611 B
Text

////////////////////////////////////////////////////////////////////////////////////////
//
// The @INTERPOLATE verb processes a string with imbedded blocks of code. The code
// blocks are parsed and evaluated. Any results are converted to a string, which
// is then inserted into the output string, replacing the code and braces.
//
// example: @INTERPOLATE "text{ @IF (x > y) then:{x} else:{y} }more text "
//
////////////////////////////////////////////////////////////////////////////////////////
@VAR v = "little";
@SAY (@INTERPOLATE "Mary had a { v } lamb");
// output: Mary had a litle lamb