Swan Lake Beta3 is here.
// This import declaration binds the prefix `io` to the `ballerina/io` module. 
// The prefix by default comes form the last part of the module name.
// The `ballerina` org name is reserved for the standard library modules.
import ballerina/io;

// `main` function is the program entry point. 
// `public` makes function visible outside the module.
public function main() {
    // Here `io:println` means function `println` is in the module bound to prefix `io`.
    io:println("Hello, World!");

}

Programs and Modules

Every Ballerina program consists of modules. Modules are one or more .bal files. The module names take the form org/x.y.z.

import ballerina/io;

This import declaration binds the prefix io to the ballerina/io module. The prefix by default comes form the last part of the module name. The ballerina org name is reserved for the standard library modules.

public function main() {

main function is the program entry point. public makes function visible outside the module.

    io:println("Hello, World!");

Here io:println means function println is in the module bound to prefix io.

}
bal run programs_and_modules.bal
Hello, World!
// This import declaration binds the prefix `io` to the `ballerina/io` module. 
// The prefix by default comes form the last part of the module name.
// The `ballerina` org name is reserved for the standard library modules.
import ballerina/io;

// `main` function is the program entry point. 
// `public` makes function visible outside the module.
public function main() {
    // Here `io:println` means function `println` is in the module bound to prefix `io`.
    io:println("Hello, World!");

}

Programs and Modules

Every Ballerina program consists of modules. Modules are one or more .bal files. The module names take the form org/x.y.z.

import ballerina/io;

This import declaration binds the prefix io to the ballerina/io module. The prefix by default comes form the last part of the module name. The ballerina org name is reserved for the standard library modules.

public function main() {

main function is the program entry point. public makes function visible outside the module.

    io:println("Hello, World!");

Here io:println means function println is in the module bound to prefix io.

}
bal run programs_and_modules.bal
Hello, World!
Subscribe to the newsletter

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