Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One Docstring for multiple Functions in Julia

Tags:

julia

I have two functions

function foo() end
function bar() end

Is it possible as in R for example to write a single docstring for both functions?

like image 903
Georgery Avatar asked Aug 03 '26 01:08

Georgery


1 Answers

Method 1 Place docstrings directly before or above defined name (s) separate by a comma.

function foo() end
function bar() end

"baz" foo, bar

"baz"
foo, bar

"""
baz
"""
foo, bar

Method 2. Multiple functions can be defined and documented directly.

"baz"
function foo() end, # note the comma
function bar() end

Method 3 Refer to docs by macro.

"baz"
function foo() end
function bar() end
@doc (@doc foo) bar

Further reading

  • Guide & Julia conventions
like image 117
Donald Seinen Avatar answered Aug 05 '26 20:08

Donald Seinen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!