In a nutshell, do-end blocks is a syntax sugar for a :do keyword list.
if CONDITION do
EXPR
end
is the same as:
if CONDITION, do: (EXPR)
You can see this by calling quote as shown by @ityonemo. Since keyword lists are just data structures, do-blocks end-up being just data structures too. It doesn’t need to be given only to macros, regular functions can also use and match on it, some helpers in Phoenix.HTML do so, but their usage is indeed more common with macros.
As a syntax sugar, they also allow some specific syntactical constructs, such as left -> right and other keywords (else, rescue, etc), but all of them can be written in the literal keyword syntax format too.






















