Getting started in Gambas
تمهيد
باختيارك البرمجة بلغة جامباس تكون قد خطوت خطوة أكثر من رائعة :-) . لغة جامباس هي لغة سهلة التعلم والإستخدام .
لغة واضحة, تستطيع الإعتماد عليها وعمل الكثير من الأشياء بها.
إن أفضل طريقة لتعلم جامباس, هي برمجة برامج نصية لكي تستطيع فهم تركيبة اللغة.
ملاحظة,إذا كنت مبرمج بيسك قديم فلن تتوه في هذه اللغة . لماذا ؟ لان تركيبة اللغة في جامباس تكاد تطابق لما هي عليه في جامباس .
إنشاء مشروع جديد
If you don't have installed جامباس yet, please before going to
this page.
The screenshots were took with old development version of Gambas. However, at the moment where i'm typing these lines, the latest stable version of Gambas is the 2.5 ! So, don't worry if some screenshots don't match with your.
Starting by run Gambas2. First of all, a beautiful window opens by asking you what you want to do :
Click on
New project. This window will open to every startup of Gambas and will allow you to run quicky what you want.
As you can see, it's relatively simple to create a new project, and you are guided step by step for his create. Here, choose
Command line application
and click on the
Next button.
Here, select your folder where your Gambas project will be saved.
Then, give a
name and a
title to your project. Applied all by clicking on
*OK button.
And here is the result!
Once your project is created, you are into the IDE of Gambas and another beautiful window opens which wishes to you the welcome in Gambas ! In your first step with Gambas, you should prefer to keep this tips window at startup. In this way, you will have more information about Gambas and its particularities as well. You will see the informations gave by that window are helpful :-) .
For the VB users, that tips window allows you to know what are the difference between Gambas and VB.
Your first program in Gambas
If you look at on the left of the IDE, you will see that you've got a module named
MMain
:
Click twice on it to open the editor. You have a base code like that :
Examples
' Gambas module file
PUBLIC SUB Main()
END
This is the main procedure of your program. i.e, it's the first procedure which is executed by the جامباس interpreter. The first of this code is a comment. You can recognize them because there've got a grey color into the editor and begins always by an apostrophe. Comments are useful to indicate informations about source code. For example, to explain what the source code do.
We're going to see how to display something on the screen. To do this, we're going to use the
PRINT statement which allows to write on the standard output. The text must be set between quotes:
' Gambas module file
PUBLIC SUB Main()
PRINT "My first program!"
END
To run the program, press the
F5
key or you can run it by
Debug -> Start
menu, or by the toolbar yet:
A small frame opens at the bottom of the IDE, this is the console. When executing the program, we're getting:
My first program!
To try out in detail the
PRINT statement, we're going to add a second
PRINT statement:
' Gambas module file
PUBLIC SUB Main()
PRINT "My first program!"
PRINT "Made in Gambas :) !"
END
Congratulation ! You made your first program in Gambas ! :-)
Now, we can go to the following tutorial. It will talk about variables, a point which is very important in programming. -
المتغيرات