Getting started in Gambas


Thanks for choosing the the Gambas programming language. Gambas is relatively easy and very powerful.

The best way to learn Gambas, as with any programming languages, is to practice.

If you are, or have been, a programmer of an other Basic programming language you should not find yourself too lost as Gambas has many similarities to other Basic languages.

Let's create a new project

The screenshots are from Gambas 3.11.4. However don't worry if some screenshots don't match your version.

The Gambas opening screen.

Click on New project.

Click on Graphical application and click on the Next button.

Select a folder to save your Gambas project. (A gambas folder is not a bad idea?)

Give your project a name and a title. Apply all by clicking on the OK button.

Your first program in Gambas

If you look at on the left of the IDE (Integrated Development Environment), you will see that you've got a Form and Class named FMain :

Click twice on it to open the Form. You will see a blank Form. Click twice on the Form to open the code window.

This is the main procedure of your program. i.e. it's the first procedure which is executed by the Gambas interpreter. The first line of code is a comment. You can recognise them because they are displayed in a grey colour and always begin with an apostrophe. Comments are useful information about your source code. For example, to explain what the code does. Comments are ignored by the Gambas interpreter.

We're going to see how to display something on the screen. To do this, we're going to use the PRINT command which allows us to write to the standard output. You need to write the line PRINT "Hello world" Note that the text must be set between quotes:

' Gambas class file

Public Sub Form_Open()

  PRINT "Hello world"


To run the program, press the F5 key or from the Debug -> Start menu, or from the toolbar:

A small frame opens at the bottom of the IDE, this is the console. When executing the program, we should see the following:

Hello world

Try adding a second PRINT command and running the program again:

' Gambas class file

Public Sub Form_Open()

  PRINT "Hello world"
  PRINT "Made in Gambas :)!"


Congratulation! You made your first Gambas program!

We can now go to the following tutorial. This will talk about variables, a subject that is important in programming. - Variables

%Integrated Development Environment is a program provided to allow the user to more easily create programs. This is particularly relevant in the case of Gambas as you can easily create graphical objects within the IDE. There is no need to find another project to create GUI (graphical user interface) code.

Last edited by Charlie Ogier 03/11/2018