# """ vs #= =# comment

**URL:** <https://discourse.julialang.org/t/vs-comment/8774>\
**Category:** General Usage\
**Created:** [February 2, 2018, 11:06am UTC](https://discourse.julialang.org/t/vs-comment/8774 "2018-02-02T11:06:19Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [February 2, 2018, 11:06am UTC](https://discourse.julialang.org/t/vs-comment/8774/1 "2018-02-02T11:06:19Z")

</div>

I always thought that

```julia
"""
Test
"""

```

is the same as

```julia
#=
Test
=#

```

But it looks like `"""` is only used in front of functions to document them, correct?

I realized this as I found out that

```julia
"""
    Test
"""

"""
    Test 2
"""
println("Test")

```

produces as error which seems weird to me.

It looks like julia tries to interpret the Test2 line which in my opinion shouldn’t be the case as this is a comment.

What are your opinions on this?

P.S. Please change the category if this isn’t the correct one 😉

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 2, 2018, 11:19am UTC](https://discourse.julialang.org/t/vs-comment/8774/2 "2018-02-02T11:19:57Z")

</div>

Please read  
[https://docs.julialang.org/en/latest/manual/documentation/](https://docs.julialang.org/en/latest/manual/documentation/)

---

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [February 2, 2018, 11:34am UTC](https://discourse.julialang.org/t/vs-comment/8774/3 "2018-02-02T11:34:25Z")

</div>

As far as I understand it: `"""` is used for documentation of methods, macros etc.  
Therefore using `"""` as I did should be bad practice 😃 Anyway I don’t really get why it produces an error.

---

<div class="post-metadata">

**Author:** ![Evizero](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evizero/32/10118_2.png) [@Evizero](https://discourse.julialang.org/u/Evizero)\
**Post date:** [February 2, 2018, 11:42am UTC](https://discourse.julialang.org/t/vs-comment/8774/4 "2018-02-02T11:42:17Z")

</div>

`"""` is used for multiline strings.

```julia
julia> myvar = """
       hello
       my friend
       """
"hello\nmy friend\n"

```

so its not a comment. Writing a string (multiline or not) before a function definition tells julia that this string is the documentation for this function

```julia
julia> "This is foo" foo(x) = x^2
foo

help?> foo
search: floor pointer_from_objref OverflowError RoundFromZero FileMonitor functionloc StackOverflowError @functionloc Factorization OutOfMemoryError

  This is foo

```

So my point is that, no, it is not a comment. do not use strings to write comments.

---

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [February 2, 2018, 11:53am UTC](https://discourse.julialang.org/t/vs-comment/8774/5 "2018-02-02T11:53:53Z")

</div>

Ah okay. Thanks for making this clear!

---

<div class="post-metadata">

**Author:** ![waldyrious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/waldyrious/32/80_2.png) [@waldyrious](https://discourse.julialang.org/u/waldyrious)\
**Post date:** [February 2, 2018, 3:16pm UTC](https://discourse.julialang.org/t/vs-comment/8774/6 "2018-02-02T15:16:43Z")

</div>

IMO that page should at least make a mention of (single- or multi-line) comments. Perhaps in one of those note boxes?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 2, 2018, 3:44pm UTC](https://discourse.julialang.org/t/vs-comment/8774/7 "2018-02-02T15:44:29Z")

</div>

I am not convinced about this. Comments and docstrings are distinct concepts, one is part of the source, the other is a value associated with objects.

---

<div class="post-metadata">

**Author:** ![waldyrious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/waldyrious/32/80_2.png) [@waldyrious](https://discourse.julialang.org/u/waldyrious)\
**Post date:** [February 2, 2018, 3:48pm UTC](https://discourse.julialang.org/t/vs-comment/8774/8 "2018-02-02T15:48:29Z")

</div>

My point exactly. They are distinct, but it’s possible for people to mix up the concepts. A small note would help make the distinction clearer IMO.

---

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [February 2, 2018, 4:30pm UTC](https://discourse.julialang.org/t/vs-comment/8774/9 "2018-02-02T16:30:04Z")

</div>

There was at least one person who was confused by this…

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 5, 2018, 9:38am UTC](https://discourse.julialang.org/t/vs-comment/8774/10 "2018-02-05T09:38:47Z")

</div>

Slightly off-topic, but I have been thinking about this and related issues in light of recent questions.

When learning a new computer language, my expectation is that I need to read about 200–300 pages of documentation (hopefully a single document, but it might be all over the place). I usually just skim through some parts that I am not immediately interested in, but it is good to know about concepts that exist in the language and I can go back to them. This takes me a couple of days (I work through examples), but prevents a lot of confusion later on.

The current manual (without `stdlib` and `devdocs`) is about 120K words, roughly 200 pages with 600 words/page (lower range for textbooks and manuals, some go higher). If many people who read this are still confused about something, then the documentation clearly needs to be improved, or possibly the syntax/semantics need to be redesigned. However, my expectation is that confusion which arises _before_ reading the documentation is an issue that needs to be remedied by the user, not the developers or the authors of the docs.

---

<div class="post-metadata">

**Author:** ![devel-chm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/devel-chm/32/3572_2.png) [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Post date:** [February 27, 2018, 9:57pm UTC](https://discourse.julialang.org/t/vs-comment/8774/11 "2018-02-27T21:57:44Z")

</div>

As a Julia-by-the-manual user at the moment: a search for “comment” in the [online Julia manual](https://docs.julialang.org/en/stable/) gave no heading or section in the results that even mentions comment syntax. If it is there, it is poorly discoverable (at least by me).

In addition, there doesn’t appear to be a section on the Julia language syntax. This is where I usually look to find information on comments.

---

<div class="post-metadata">

**Author:** ![JackDevine](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jackdevine/32/1048_2.png) [@JackDevine](https://discourse.julialang.org/u/JackDevine)\
**Post date:** [February 27, 2018, 10:22pm UTC](https://discourse.julialang.org/t/vs-comment/8774/12 "2018-02-27T22:22:28Z")

</div>

If you search comment, then one of the sections suggested is the [Punctuation](https://docs.julialang.org/en/stable/stdlib/punctuation/#Punctuation-1) section, which does tell you how to do multiline comments. Although it doesn’t tell you how to do multiline strings, which is possibly an omission?

---

<div class="post-metadata">

**Author:** ![devel-chm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/devel-chm/32/3572_2.png) [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Post date:** [February 27, 2018, 10:47pm UTC](https://discourse.julialang.org/t/vs-comment/8774/13 "2018-02-27T22:47:05Z")

</div>

Apparently my problem was that I was looking at “Latest” and not “Stable” or “0.6.2”. Definitely discoverable there. Thanks!
