What's the official way of writing output in Code Example

39 views
Skip to first unread message

eksperimental

unread,
May 16, 2016, 11:58:26 AM5/16/16
to elixir-l...@googlegroups.com
Hi everyone,

I was writting some docs, and I realize I don't know how to do this.

when using docstests, we can do

iex> ex = fn -> IO.puts(:elixir); :rocks end
...> ex.()
#=> elixir
:rocks

but what is the proper way to do this when it is not a doctest?
How do i differentiate what written to std_io, from what it's being
returned.

ex = fn -> IO.puts(:elixir); :rocks end
ex.()

thank you

eksperimental

unread,
May 16, 2016, 12:04:37 PM5/16/16
to elixir-l...@googlegroups.com
sorry, I messed things up when I wrote my previous email

#=> is used in regular code (not doctests) to indicate "returned
value".

plain code:
:foo
#=> :foo

doctest:
iex> :foo
:foo

But how do I represent a value printed on to stdout?
in doctest and regular code
Reply all
Reply to author
Forward
0 new messages