# The value of a function's definition varies after a docstring is added

**URL:** https://discourse.julialang.org/t/the-value-of-a-functions-definition-varies-after-a-docstring-is-added/99779
**Category:** General Usage
**Tags:** question
**Created:** [June 2, 2023, 4:45pm UTC](https://discourse.julialang.org/t/the-value-of-a-functions-definition-varies-after-a-docstring-is-added/99779 "2023-06-02T16:45:05Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)
#### Post date: [June 2, 2023, 4:45pm UTC](https://discourse.julialang.org/t/the-value-of-a-functions-definition-varies-after-a-docstring-is-added/99779/1 "2023-06-02T16:45:06Z")

</div>

1. Run code:

```julia
function sayHello()
    println("Hello, world!")
end

```

it returns `sayHello (generic function with 1 method)`.

1. Run code:

```julia
"""
Say hello world
"""
function sayHello()
    println("Hello, world!")
end

```

it returns `sayHello` only.

Why are they designed to have different values?

---

<div class="post-metadata">

### Author: ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)
#### Post date: [June 2, 2023, 4:49pm UTC](https://discourse.julialang.org/t/the-value-of-a-functions-definition-varies-after-a-docstring-is-added/99779/2 "2023-06-02T16:49:25Z")

</div>

Not sure why this happens (good catch) but in the end both have the exact same type and behavior. This is just a display quirk.

---

<div class="post-metadata">

### Author: ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)
#### Post date: [June 2, 2023, 4:52pm UTC](https://discourse.julialang.org/t/the-value-of-a-functions-definition-varies-after-a-docstring-is-added/99779/3 "2023-06-02T16:52:00Z")

</div>

OK, thanks! 🤝

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [June 2, 2023, 4:54pm UTC](https://discourse.julialang.org/t/the-value-of-a-functions-definition-varies-after-a-docstring-is-added/99779/4 "2023-06-02T16:54:12Z")

</div>

```julia
julia> """
       Say hello world
       """
       function sayHello()
           println("Hello, world!")
       end
sayHello

julia> sayHello
sayHello (generic function with 1 method)

```

so if you look at the second definition afterwards in REPL you get the same as for the first. The difference might just be how the “add documentation as well” part is processed?

---

<div class="post-metadata">

### Author: ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)
#### Post date: [June 2, 2023, 4:57pm UTC](https://discourse.julialang.org/t/the-value-of-a-functions-definition-varies-after-a-docstring-is-added/99779/5 "2023-06-02T16:57:18Z")

</div>

🤔

---

<div class="post-metadata">

### Author: ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)
#### Post date: [June 2, 2023, 8:14pm UTC](https://discourse.julialang.org/t/the-value-of-a-functions-definition-varies-after-a-docstring-is-added/99779/6 "2023-06-02T20:14:29Z")

</div>

yeah - same behavior (or, behaviour? 🙂 )

```julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.9.0 (2023-05-07)
 _/ |\ __'_|_|_|\__'_| |
|__/ |

julia> "say hello"
       function sayHello()
           println("hello")
       end
sayHello

```
