Owens

Owens

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?

Showing Posts 1 to 4

NobbZ

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.

sztosz

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

Nicd

Nicd

I renamed the topic and moved to a generic section as it’s not Phoenix specific.

The first thing I do is enable shell history: IEx — IEx v1.20.2

idi527

idi527

:waving_hand:

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 …

— All posts loaded —

Where Next? Top

Trending in Discussions Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
jtormey
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews