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.
-
with Text_IO; use Text_IO;- This imports (
with) theText_IOpackage, which provides input/output functionalities. - The
use Text_IO;statement allows direct use of functions likePut_Linewithout needing to prefix them withText_IO..
- This imports (
-
procedure Hello is- Defines a procedure named
Hello, which acts like the main function in Ada.
- Defines a procedure named
-
begin- Marks the start of the procedure's execution block.
-
Put_Line("Hello World!!!");- The
Put_Linefunction prints"Hello World!!!"followed by a new line.
- The
-
end Hello;- Indicates the end of the
Helloprocedure.
- Indicates the end of the
Key Features:
- Strongly Typed: Ada is a strongly typed language, ensuring safety and reliability.
- Structured Syntax: Procedures in Ada are explicitly defined with
beginandend. - 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!!!