Julia Documentation

313 阅读1分钟

Julia 的文档

Julia给一个函数写文档非常简单,函数定义上方的字符串会被认为是函数的文档,就像:

"Tell whether there are too foo items in the array." 
foo(xs::Array) = ...

文档被解释为Markdown,因此可以使用缩进来分隔文本中的代码示例。比如说以下是一个更复杂的例子

"""
    bar(x[, y])

Compute the Bar index between `x` and `y`.

If `y` is unspecified, compute the Bar index between all pairs of columns of `x`.

# Examples
julia> bar([1, 2], [1, 2])
1
"""
function bar(x, y) ...