Catalog / Ada Programming Language Cheatsheet
Ada Programming Language Cheatsheet
A quick reference guide to the Ada programming language, covering syntax, data types, control structures, and advanced features for both beginners and experienced programmers.
Basic Syntax and Data Types
Program Structure
An Ada program consists of a main procedure and optional subprograms (procedures and functions).
|
with clause: Imports packages. |
Data Types
|
Represents whole numbers. Example:
|
|
Represents floating-point numbers. Example:
|
|
Represents truth values ( Example:
|
|
Represents single characters. Example:
|
|
Represents a sequence of characters. Example:
|
Variable Declaration
Variables are declared with a name, type, and optional initial value.
Example:
|
Control Structures
Conditional Statements
if statements allow conditional execution of code.
|
Example:
|
Looping Statements
|
Iterates a specific number of times.
|
|
Executes as long as a condition is true.
|
|
General loop construct, useful with
|
Case Statements
The
Example:
|
Subprograms (Procedures and Functions)
Procedures
Procedures are subprograms that perform actions but do not return a value.
Example:
|
Functions
Functions |
Functions are subprograms that perform calculations and return a value.
|
Example |
|
Parameter Modes |
|
Overloading
Ada supports overloading of subprograms, allowing multiple subprograms with the same name but different parameter lists.
|
Arrays and Records
Arrays
Arrays are collections of elements of the same type, accessed by an index.
Example:
|
Array Attributes |
|
Records
Records |
Records are collections of named fields, possibly of different types.
|
Example |
|
Accessing Elements
Array elements are accessed using their index within the array.
Record fields are accessed using the dot notation.
|