Skip to content

Commit

Permalink
Merge pull request JuliaLang#9937 from Ismael-VC/patch-1
Browse files Browse the repository at this point in the history
[ci skip] Document multiline anonymous function with `function ... end`.
  • Loading branch information
ivarne committed Jan 27, 2015
2 parents f8b0bac + 7ed9134 commit 0d189ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion doc/manual/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,18 @@ Functions in Julia are `first-class objects
variables, called using the standard function call syntax from the
variable they have been assigned to. They can be used as arguments, and
they can be returned as values. They can also be created anonymously,
without being given a name:
without being given a name, using either of these syntaxes:

.. doctest::

julia> x -> x^2 + 2x - 1
(anonymous function)

julia> function (x)
x^2 + 2x - 1
end
(anonymous function)

This creates an unnamed function taking one argument *x* and returning the
value of the polynomial *x*\ ^2 + 2\ *x* - 1 at that value. The primary
use for anonymous functions is passing them to functions which take
Expand Down

0 comments on commit 0d189ed

Please sign in to comment.