How to create a multiline string variable in swig template?

I'm trying to create a multiline string variable in swig :

{% set myVariable = "
  multi
  line
  string
" %}

Then I log it :

{% logMyVariable(myVariable) %}

But I don't understand why my variable is not displayed on several lines :

multi line string

Whereas I was expecting :

multi
line 
string

Do you know how I could do that?

In HTML, new lines in text aren’t rendered when the text is displayed. For example, this HTML:

<p>Let’s split this sentence up
onto
multiple
lines.</p>

Will render like this:

Let’s split this sentence up onto multiple lines.

You might want to wrap your log in a <pre> tag, as that will preserve new lines (and multiple spaces between words, which are also ignored in rendered HTML):

<pre>{% logMyVariable(myVariable) %}</pre>

Please try it like this:

{% set myVariable = "
  multi\n
  line\n
  string
" %}

and if that does not work:

{% set myVariable = "
  multi<br />
  line<br />
  string
" %}