如何在Julia文档字符串中缩进?

问题描述

我想在Julia文档字符串中包含一个循环,但是当我尝试使用看起来很明显的方式时,缩进不会显示

"""
Function: dave

Arguments

  x: first number

  y: second number

Returns

  interaction_sum: x + y + xy

Examples

#=

for i in 1:5

    println(dave(i,i)) # 3,8,15,24,35

end

=#

"""

但是,当我在函数前面加上问号以获取文档时,循环的缩进不存在。

Function: dave
Arguments
x: first number
y: second number
Returns 
interaction_sum: x + y + xy
Examples
#=
for i in 1:5
println(dave(i,35
end
=#

我在Python中没有这样的问题。如何使这些标签显示在Julia中?

解决方法

有关如何设置文档字符串格式的更多详细信息,请阅读Documentation部分。

julia> """
           dave

       # Arguments

         x: first number

         y: second number

       # Returns

         interaction_sum: x + y + xy

       # Examples

       ```
       for i in 1:5

           println(dave(i,i)) # 3,8,15,24,35

       end

       ```
       """
       function dave() end
help?> dave
search: dave code_native @code_native readavailable

  dave

  Arguments
  ≡≡≡≡≡≡≡≡≡≡≡

  x: first number

  y: second number

  Returns
  ≡≡≡≡≡≡≡≡≡

  interaction_sum: x + y + xy

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  for i in 1:5
  
      println(dave(i,35
  
  end

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...