Skip to content

Commit

Permalink
Update example in Functions/Arg destructuring (JuliaLang#27014)
Browse files Browse the repository at this point in the history
The example in Argument destructuring didn't work when I typed it in, so I changed the name to `gap()`.
  • Loading branch information
cormullion committed May 1, 2020
1 parent 5def3e6 commit c466e8a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions doc/src/manual/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,14 @@ a symbol, then an assignment `(x, y) = argument` will be inserted for you:
```julia
julia> minmax(x, y) = (y < x) ? (y, x) : (x, y)

julia> range((min, max)) = max - min
julia> gap((min, max)) = max - min

julia> range(minmax(10, 2))
julia> gap(minmax(10, 2))
8
```

Notice the extra set of parentheses in the definition of `range`.
Without those, `range` would be a two-argument function, and this example would
not work.
Notice the extra set of parentheses in the definition of `gap`. Without those, `gap`
would be a two-argument function, and this example would not work.

## Varargs Functions

Expand Down

0 comments on commit c466e8a

Please sign in to comment.