fmcgeough
Want to pipe into a Case statement? You can!
pipe into case? I use that fairly frequently…unless I’m misunderstanding what you’re wanting…could be.. its still very early…
str = "Hello"
str |> case do
"Goodbye" -> "see ya!"
"Hello" -> "welcome!"
end
Most Liked
sztosz
I always find this something |> IO.inspect() more readable than IO.inspect(something) I really don’t see nothing wrong with piping even when there is only one pipe
If you do
something
|> do_something()
|> do_something_else()
|> with_additional_param(param)
then what’s wrong with just
something |> do_something()
I think we should not mistake readability with familiarity. Just my 2 cents.
dbern
Piping into case is pretty cool, but after I do it, I realize it’s often better for me to wrap that case statement into a function that I can name so it reveals the intention a little better.
I especially don’t like doing it in the middle of a pipeline. I find myself using case statements more often in Phoenix controllers to handle the happy path and unhappy path.
OvermindDL1
Yep this! I pipe into case statements probably a lot more excessively than I really should… ^.^;
And I pipe into if and other such things as well… >.>
Popular in Guides/Tuts
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









