Print a docstring of a program to stdout in Julia

Viewed 149

Julia accepts ?sin on the command line to display a help text. I believe such help texts are implemented as docstrings. I would like to print such docstrings from my Julia program at runtime. How to do that?

1 Answers
julia> @doc sin
  sin(x)

  Compute sine of x, where x is in radians.

  sin(A::AbstractMatrix)

  Compute the matrix sine of a square matrix A.

  If A is symmetric or Hermitian, its eigendecomposition (eigen) is used to compute the
  sine. Otherwise, the sine is determined by calling exp.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> sin(fill(1.0, (2,2)))
  2×2 Matrix{Float64}:
   0.454649  0.454649
   0.454649  0.454649
Related