ADA Program to print Hello World

Program

with Text_IO; use Text_IO;
procedure Hello is
begin
	Put_Line("Hello World!!!");
end Hello;

This simple Ada program prints "Hello World!!!" to the console.

  1. with Text_IO; use Text_IO;

    • This imports (with) the Text_IO package, which provides input/output functionalities.
    • The use Text_IO; statement allows direct use of functions like Put_Line without needing to prefix them with Text_IO..
  2. procedure Hello is

    • Defines a procedure named Hello, which acts like the main function in Ada.
  3. begin

    • Marks the start of the procedure's execution block.
  4. Put_Line("Hello World!!!");

    • The Put_Line function prints "Hello World!!!" followed by a new line.
  5. end Hello;

    • Indicates the end of the Hello procedure.

Key Features:

  • Strongly Typed: Ada is a strongly typed language, ensuring safety and reliability.
  • Structured Syntax: Procedures in Ada are explicitly defined with begin and end.
  • Reliable & Secure: Ada is widely used in critical systems like aerospace and military applications.

Output

$ gnat make hello.adb 
gcc -c hello.adb
gnatbind -x hello.ali
gnatlink hello.ali
$ ./hello 
Hello World!!!