From 7ed91341aaa7c77f49cce52ac926607755fa2588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismael=20Venegas=20Castell=C3=B3?= Date: Tue, 27 Jan 2015 10:36:41 -0600 Subject: [PATCH] Document multiline anonymous function. Version using `function` keyword with no name. Correcting a typo. --- doc/manual/functions.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/manual/functions.rst b/doc/manual/functions.rst index 2b746d440e7d4..c8c22d9f52b6a 100644 --- a/doc/manual/functions.rst +++ b/doc/manual/functions.rst @@ -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