2 Synthesis‎ > ‎Computing‎ > ‎Programming‎ > ‎Ada‎ > ‎

Quick Start

To start programming Ada within Ubuntu Linux is very easy.

Go to the menu bar and select;

System > Administration > Synaptic Package Manager

Use the Synaptic Package Manager to install;

gnat-4.4   The GNU Ada compiler

If a later version is available you could use that.

Example 1: Hello World

Go to the menu bar and select;

Applications > Accessories > gedit Text Editor

Then into the editor paste the following;

with Ada.Text_IO;
procedure hello is
   Ada.Text_IO.Put_Line("Hello, world!");
end hello;

then save it creating the following path in your home directory


Go to the menu bar and select;

Applications > Accessories > Terminal

In terminal type;

cd projects/ada

In terminal type;

gnat make hello.adb

the program compiles. Now type;


The program runs printing;

Hello, world!

Example 2: What is your name?

Replace the program above with this;

with Ada.Text_IO;
procedure hello is
   s: String (1..100);
   n: Integer;
Ada.Text_IO.Put_Line("Hello, what is your name?");
Ada.Text_IO.Put("Hello ");
end hello;

Now compile and run it just as you did the program above. The program runs printing;

Hello, what is your name?

Respond by typing your name i.e.;


And press <enter>. The program responds;

Hello TomX��������.���.����&3�((�...��h�T .�oU蜃��

In my case. Your gobbledegook might be different. Now of course Ada is idiot proof right! Oh no did I say that! Replace;




Now it works but what this shows is that Ada is not idiot proof! I am not impressed. But let this exploration continue a little longer before I run back to C or C++.

Next I decided to see how Ada copes when you run over the end of the array. I replaced s: String (1..100); with s: String (1..3); just for a laugh and ran it putting "Thomas" instead of "Tom" the reply was "Hello Tho". OK so it didn't crash the system but there was no indication of the overflow on Ada.Text_IO.Get_Line(s,n); which isn't good. Perhaps I need to check for some sort of error return? In C or C++ this would be an intermittent killer error i.e. it would lead to all kinds of unpredictable outcomes.

Example 3:



© Tom de Havas 2011. The information under this section is my own work it may be reproduced without modification but must include this notice.