Skip to content

Commit a32ce8b

Browse files
committed
Provide more rationale on do-end
1 parent 331e565 commit a32ce8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: lib/elixir/pages/getting-started/keywords-and-maps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ iex> if true, do: "This will be seen", else: "This won't"
127127

128128
Pay close attention to both syntaxes. In the keyword list format, we separate each key-value pair with commas, and each key is followed by `:`. In the `do`-blocks, we get rid of the colons, the commas, and separate each keyword by a newline. They are useful exactly because they remove the verbosity when writing blocks of code. Most of the time, you will use the block syntax, but it is good to know they are equivalent.
129129

130-
Note that only a handful of keyword lists can be converted to blocks: `do`, `else`, `catch`, `rescue`, and `after`. Those are all the keywords used by Elixir control-flow constructs. We have already learned some of them and we will learn others in the future.
130+
This plays an important role in the language as it allows Elixir syntax to stay small but still expressive. We only need few data structures to represent the language, a topic we will come back to when talking about [optional syntax](optional-syntax.md) and go in-depth when discussing [meta-programming](../quote-and-unquote.md).
131131

132132
With this out of the way, let's talk about maps.
133133

0 commit comments

Comments
 (0)