OutputLine Function

The OutputLine function is similar to the Output Function with the addition of a carriage return (CRLF) at the end of the output. It 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.

Example:

Here is an example using both the Output function and OutputLine function:



%%[ var @output
Set @output = ‘hello ‘
OutputLine(Concat(@output, “there”))
Output(Concat(@output, “there”)) ]%%

Output:

hello there hello there

(with carriage return)

Explanation:

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:

More Examples:

A few more examples using the Output Function and the expected output.



%%[ var @output
Set @output = ‘1’
Output(Add(@output, 1)) ]%%

Output:

2
(with carriage return)

Using the Concat function



%%[ var @output
Set @output = ‘hello ‘
Output(Concat(@output, “there”)) ]%%

Output:

hello there
(with carriage return)

Leave a Reply

Your email address will not be published. Required fields are marked *