Skip to content

Update syntax style on examples #731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions crash-course.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ Elixir supports a literal syntax for regular expressions. Such syntax allows reg
**Erlang**

```erlang
{ ok, Pattern } = re:compile("abc\\s").
{ok, Pattern} = re:compile("abc\\s").
re:run("abc ", Pattern).
%=> { match, ["abc "] }
%=> {match,[{0,4}]}
```

**Elixir**
Expand Down
2 changes: 1 addition & 1 deletion getting-started/basic-types.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ iex> list = [1|[2|[3|[]]]]
This means accessing the length of a list is a linear operation: we need to traverse the whole list in order to figure out its size. Updating a list is fast as long as we are prepending elements:

```iex
iex> [0 | list]
iex> [0|list]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's better if we keep this with spaces, given there's a discussion in an Elixir PR around deciding on the [x | y] style once and for all, throughout all Elixir's codebase. :) Same applies to the other occurrences below.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a commit ready to send fixing all the spaces around the |,
I will send it soon

[0, 1, 2, 3]
```

Expand Down
4 changes: 2 additions & 2 deletions getting-started/pattern-matching.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ iex> a
A list also supports matching on its own head and tail:

```iex
iex> [head | tail] = [1, 2, 3]
iex> [head|tail] = [1, 2, 3]
[1, 2, 3]
iex> head
1
Expand All @@ -106,7 +106,7 @@ iex> [h|t] = []
** (MatchError) no match of right hand side value: []
```

The `[head | tail]` format is not only used on pattern matching but also for prepending items to a list:
The `[head|tail]` format is not only used on pattern matching but also for prepending items to a list:

```iex
iex> list = [1, 2, 3]
Expand Down