Turning case-do up to 11

I keep forgetting that construct exists!

Thanks! (Sorry for the late reply… busy busy.)

But does the construct truly do anything but open a new scope?

Like, let’s look at the example in the docs, and rewrite it:

opts = %{width: 10, height: 15}
if true do
  {:ok, width}  = Map.fetch(opts, :width)
  {:ok, height} = Map.fetch(opts, :height)
  {:ok, width * height}
end

I have no elixir environment at this computer, but this should be the equivalent, right? Or did I miss something?

[EDIT: I guess the else block for failed matches is of course awesome.]

Could you please give me an example of how you would rewrite a nested case-do statement so I get a better idea of what you’re aiming at?