The Output function is used with other AMPscript functions like the V function where it returns the results of AMPscript code, but within a code block. Must use an AMPscript function within the Output function such as the Concat function.
For example, if you want to output within an AMPscript code block:
%%[ var @output Set @output = ‘My output’ Output(v(@output)) ]%%
In this example, we have one AMPscript code block and can output the variable @output without having to close the AMPscript block. An example using a standalone V Function, the AMPscript block must be closed.
Note that you can replace the V Function with any other AMPscript function. A few more examples below:
A few more examples using the Output Function and the expected output.
%%[ var @output Set @output = ‘1’ Output(Add(@output, 1)) ]%%
Using the Concat function
%%[ var @output Set @output = ‘hello ‘ Output(Concat(@output, “there”)) ]%%