1

When documenting parameters of methods with Scaladoc, we can write:

  /** Is number even 
   * @param i number
   * @return true if i is even, false otherwise
   */
  def isEvenDef(i: Int) = i % 2 == 0

Which after generating the docs (e.g. via doc from sbt) yields nice documentation of the parameters (pointless in this example, but useful in general):

enter image description here

However, writing an analogous function via val and using the same documentation:

  /** Is number even 
   * @param i number
   * @return true if i is even, false otherwise
   */
  val isEvenVal = (i: Int) => i % 2 == 0

The param does not seem to show in the generated documentation:

enter image description here

Is there a way do document the parameters for functions defined via val such that they show similarly to the parameters of methods defined via def?

Jozef
  • 2,617
  • 14
  • 19

0 Answers0