Swan Lake Beta2 is here.
// Lines starting with `#` contain structured documentation in Markdown format.
# Adds two integers.
// Documenting parameters of the function
# + x - an integer
# + y - another integer
// Documenting return parameter of the function
# + return - the sum of `x` and `y`
public function add(int x, int y)
                     returns int {

  return x + y;
}

Documentation

Annotations would be inconvenient for specifying structured documentation. Ballerina-flavored Markdown (BFM) is additional conventions on top of Markdown, which makes it more convenient for documenting Ballerina code.

# Adds two integers.

Lines starting with # contain structured documentation in Markdown format.

# + x - an integer
# + y - another integer

Documenting parameters of the function

# + return - the sum of `x` and `y`
public function add(int x, int y)
                     returns int {

Documenting return parameter of the function

  return x + y;
}
bal run documentation.bal
// Lines starting with `#` contain structured documentation in Markdown format.
# Adds two integers.
// Documenting parameters of the function
# + x - an integer
# + y - another integer
// Documenting return parameter of the function
# + return - the sum of `x` and `y`
public function add(int x, int y)
                     returns int {

  return x + y;
}

Documentation

Annotations would be inconvenient for specifying structured documentation. Ballerina-flavored Markdown (BFM) is additional conventions on top of Markdown, which makes it more convenient for documenting Ballerina code.

# Adds two integers.

Lines starting with # contain structured documentation in Markdown format.

# + x - an integer
# + y - another integer

Documenting parameters of the function

# + return - the sum of `x` and `y`
public function add(int x, int y)
                     returns int {

Documenting return parameter of the function

  return x + y;
}
bal run documentation.bal

In the creation of Ballerina, we were inspired by so many technologies. Thank you to all that have come before us (and forgive us if we missed one): Java, Go, C, C++, D, Rust, Haskell, Kotlin, Dart, TypeScript, JavaScript, Python, Perl, Flow, Swift, Elm, RelaxNG, NPM, Crates, Maven, Gradle, Kubernetes, Docker, Envoy, Markdown, GitHub and WSO2.

Cookie Policy

This website uses cookies so that we can provide you with the best user experience. Read our Cookie Policy to find out more.

If you wish to disable cookies you can do so from your browser.

I Understand