Returns a doc string from a closure.
An empty string (""
) is returned if the closure has no doc string.
This function does not generate a change.
closure.doc()
None
Returns the doc string.
This code creates a closure with a doc string:
add_one = |x| {
"Adds one to a given value.";
x+1;
};
// Return the doc string
add_one.doc();
Return value in JSON format
"Adds one to a given value."