# Print string with multiple lines without identation

**URL:** <https://discourse.julialang.org/t/print-string-with-multiple-lines-without-identation/61171>\
**Category:** New to Julia\
**Tags:** strings\
**Created:** [May 14, 2021, 5:53pm UTC](https://discourse.julialang.org/t/print-string-with-multiple-lines-without-identation/61171 "2021-05-14T17:53:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [May 14, 2021, 5:53pm UTC](https://discourse.julialang.org/t/print-string-with-multiple-lines-without-identation/61171/1 "2021-05-14T17:53:16Z")

</div>

Is there some macro that allows me to write strings with multiple lines removing the identiation of the code? Meaning:

```julia
julia> println("function f(x)
                    y = x + 1
                    return y
                end")
function f(x)
            y = x + 1
            return y
         end

```

I would like that that printed what this prints:

```julia
julia> println("function f(x)
           y = x + 1
           return y
       end")
function f(x)
    y = x + 1
    return y
end

```

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [May 14, 2021, 5:58pm UTC](https://discourse.julialang.org/t/print-string-with-multiple-lines-without-identation/61171/2 "2021-05-14T17:58:12Z")

</div>

Use multiline string literals:

```julia
julia> println("""
               function f(x)
                   y = x + 1
                   return y
               end
               """)
function f(x)
    y = x + 1
    return y
end

```

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [May 14, 2021, 6:05pm UTC](https://discourse.julialang.org/t/print-string-with-multiple-lines-without-identation/61171/3 "2021-05-14T18:05:22Z")

</div>

Do you know what the rules are here? Does the minimum number of leading white spaces before the first non-whitespace character treated become the offset? I could imagine that example returning a string with lots of leading white space, but it doesn’t.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [May 14, 2021, 6:15pm UTC](https://discourse.julialang.org/t/print-string-with-multiple-lines-without-identation/61171/4 "2021-05-14T18:15:38Z")

</div>

> […] triple-quoted strings are dedented to the level of the least-indented line […]

From [Triple Quoted String Literals](https://docs.julialang.org/en/v1/manual/strings/#Triple-Quoted-String-Literals) in the documentation.
