Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/elixir/pages/getting-started/sigils.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The reason behind supporting different delimiters is to provide a way to write l

## Strings, charlists, and word lists sigils

Besides regular expressions, Elixir ships with three other sigils.
Elixir ships with three sigils for building textual data structures. These allow you to choose an appropriate delimiter for your literal text such that you do not have to worry about escaping.

### Strings

Expand Down Expand Up @@ -89,9 +89,9 @@ iex> ~w(foo bar bat)a
[:foo, :bar, :bat]
```

## Interpolation and escaping in string sigils
## Interpolation and escaping in textual sigils

Elixir supports some sigil variants to deal with escaping characters and interpolation. In particular, uppercase letters sigils do not perform interpolation nor escaping. For example, although both `~s` and `~S` will return strings, the former allows escape codes and interpolation while the latter does not:
Elixir supports some sigil variants to deal with escaping characters and interpolation. In particular, uppercase-letter textual sigils do not perform interpolation nor escaping. For example, although both `~s` and `~S` will return strings, the former allows escape codes and interpolation while the latter does not:

```elixir
iex> ~s(String with escape codes \x26 #{"inter" <> "polation"})
Expand All @@ -100,7 +100,7 @@ iex> ~S(String without escape codes \x26 without #{interpolation})
"String without escape codes \\x26 without \#{interpolation}"
```

The following escape codes can be used in strings and charlists:
The following escape codes can be used in textual sigils:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure about this modification being fully accurate, but the ~w sigil seems to behave similarly to its peers (aside from stripping whitespace escape codes, which I do not find surprising behaviour).


* `\\` – single backslash
* `\a` – bell/alert
Expand Down