Owens
Tips and Tricks for Working in IEx
Anyone have some tips for running functions or other things you commonly do in iex?
I am trying to figure out how to run a do loop with multiple lines and can’t figure it out.
It’s easy to do one line like this:
iex> for i <- 0..100, i > 0, do: WHAT YOU WANT TO DO
Also how would one use the Rails equivalent of Byebug?
Most Liked
sztosz
Byebug… i don’t know how much it can do, because I found Pry much superior in Ruby world, and there is Pry in Elixir world too, anyway, here’s little article that I think will be helpful Debugging techniques in Elixir « Plataformatec Blog
idi527
![]()
Not sure about other text editors, but in spacemacs with alchemist it’s possible to send snippets of code from a buffer into the repl, so I use that sometimes. Although most often I just edit and save the module’s source code and rely on code reloading (with exsync, for example) to also update the loaded modules in the repl.
For “debugging” I tend to use tracing, like rexbug. I haven’t found a way to do step-through debugging sensibly with elixir …
NobbZ
iex(2)> Enum.map([1,2,3], fn a ->
...(2)> IO.puts a
...(2)> a * a
...(2)> end)
Just writing them out as you would do in an editor is sufficient.
It would work for a comnprehension as well, just hit enter after do (no cologn!).
I have no clue what Byebug is, so can’t help you with that.
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








