Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Latest commit

 

History

History

writing-hello-world

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Writing Hello World in Ballerina

Creating a new Ballerina project

  1. Go to File -> New -> Project. Select Ballerina project type and click Next button.

alt text

  1. In the next step, we are prompted to select a SDK for the project. If you haven't already added a SDK, please follow Setting up Ballerina SDK documentation to add a new SDK.

    Select the SDK and click Next button.

alt text

  1. Update the project name and the location and click Next button.

alt text

Now you have successfully created a new Ballerina project.

alt text

Creating a new Ballerina file

  1. Right click on the project and select New -> Ballerina File.

alt text

  1. Enter the file name and click OK button. We use Ballerina Main as the Kind. This will create a new file with a main function.

alt text

Now you should have a new Ballerina file with a main function.

alt text

Running Ballerina files

Running Ballerina mains

Near the main function, in the gutter area, Run icon can be found.

alt text

Clicking on this Run icon, available commands can be viewed.

alt text

Select Run command. This will run the main function and show the output in the Run window.

alt text

Note: You can right click on the file and run the main method as well.

Running Ballerina services

This is similar to running main functions. Near the service definition, in the gutter area, Run icon can be found. Clicking on this Run icon, available commands can be viewed. Select Run command. This will start the service and show the output in the Run window. Please note that running a Ballerina file with few services will start all services in that file.

alt text

Note: You can right click on the file and run the services as well.