Back to VS Code home
Follow the steps below to run a sample Ballerina program in VS Code.
Use the code view
Follow the steps below to use the code view to run a Ballerina program.
Note: Skip the steps 1-3 if you already have a Ballerina code.
-
Click View in the menu bar of the editor, and click Command Palette.
Tip: Alternatively, use the shortcut methods
⌘ + ↑ + P
on macOS andCtrl + Shift + P
on Windows and Linux. -
In the search bar, type
Show Examples
, and click Ballerina: Show Examples. -
Select the Hello World Main example.
-
Run the program using one of the options below.
-
Option 1
Click on the Run CodeLens on the editor.
-
Option 2
Click Run on the title bar of the editor.
-
Use the diagram view
Follow the steps below to use the code view to run a Ballerina program.
-
Click Show Diagram on the title bar of the editor to view the graphical representation of the program.
-
Click Run on the title bar of the editor.
The integrated terminal will open automatically and run the program.
Tip: Click the Debug CodeLens to debug the Ballerina program you ran. For more information, see Debug the code.