# Capture returned string from show

**URL:** <https://discourse.julialang.org/t/capture-returned-string-from-show/61132>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [May 14, 2021, 8:54am UTC](https://discourse.julialang.org/t/capture-returned-string-from-show/61132 "2021-05-14T08:54:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![henry2004y](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henry2004y/32/9284_2.png) [@henry2004y](https://discourse.julialang.org/u/henry2004y)\
**Post date:** [May 14, 2021, 8:54am UTC](https://discourse.julialang.org/t/capture-returned-string-from-show/61132/1 "2021-05-14T08:54:36Z")

</div>

Hi,

I want to capture the returned string from a dispatched `show` function on my customized type, but somehow it always returns an empty string:

```julia
struct MyType
end

a = MyType()

Base.show(io::IO, ::MyType) = println("hello")

b = repr(a) # b == ""

```

What should be the right way to this?

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [May 14, 2021, 8:59am UTC](https://discourse.julialang.org/t/capture-returned-string-from-show/61132/2 "2021-05-14T08:59:36Z")

</div>

> [@henry2004y](#):
>
> `println("hello")`

This should be `println(io, "hello")`.
