An Ada program consists of a main procedure and optional subprograms (procedures and functions).
with Ada.Text_IO;
use Ada.Text_IO;
procedure Hello_World is
begin
Put_Line ("Hello, World!");
end Hello_World;
A quick reference guide to the Ada programming language, covering syntax, data types, control structures, and advanced features for both beginners and experienced programmers.
An Ada program consists of a main procedure and optional subprograms (procedures and functions).
|
with clause: Imports packages. |
|
Represents whole numbers. Example:
|
|
Represents floating-point numbers. Example:
|
|
Represents truth values ( Example:
|
|
Represents single characters. Example:
|
|
Represents a sequence of characters. Example:
|
Variables are declared with a name, type, and optional initial value.
Example:
|
if statements allow conditional execution of code.
|
Example:
|
|
Iterates a specific number of times.
|
|
Executes as long as a condition is true.
|
|
General loop construct, useful with
|
The
Example:
|
Procedures are subprograms that perform actions but do not return a value.
Example:
|
Functions |
Functions are subprograms that perform calculations and return a value.
|
Example |
|
Parameter Modes |
|
Ada supports overloading of subprograms, allowing multiple subprograms with the same name but different parameter lists.
|
Arrays are collections of elements of the same type, accessed by an index.
Example:
|
Array Attributes |
|
Records |
Records are collections of named fields, possibly of different types.
|
Example |
|
Array elements are accessed using their index within the array.
Record fields are accessed using the dot notation.
|