Skip to content

Commit 24efbdf

Browse files
authored
Document whitespace rules for keyword syntax (#12773)
1 parent 36e7105 commit 24efbdf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/elixir/pages/references/syntax-reference.md

+2
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ Atoms with foreign characters, such as whitespace, must be wrapped in quotes. Th
470470

471471
Remember that, because lists and two-element tuples are quoted literals, by definition keywords are also literals (in fact, the only reason tuples with two elements are quoted literals is to support keywords as literals).
472472

473+
In order to be valid keyword syntax, `:` cannot be preceded by any whitespace (`foo : 1` is invalid) and has to be followed by whitespace (`foo:1` is invalid).
474+
473475
### Keywords as last arguments
474476

475477
Elixir also supports a syntax where if the last argument of a call is a keyword list then the square brackets can be skipped. This means that the following:

0 commit comments

Comments
 (0)