Jump to content

Ada Programming/Statements

From Wikibooks, open books for an open world
This computer programming article is available in pseudocode, Ada, C, C++, and Delphi.

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

Note: there are some simplifications in the explanations below. Don't take anything too literally.

Most programming languages have the concept of a statement. A statement is a command that the programmer gives to the computer. For example:

Ada.Text_IO.Put_Line ("Hi there!");

This command has a verb ("Put_Line") and other details (what to print). In this case, the command "Put_Line" means "show on the screen," not "print on the printer." The programmer either gives the statement directly to the computer (by typing it while running a special program), or creates a text file with the command in it. You could create a file called "hi.txt", put the above command in it, and give the file to the computer.

If you have more than one command in the file, each will be performed in order, top to bottom. So the file could contain:

Ada.Text_IO.Put_Line ("Hi there!");
Ada.Text_IO.Put_Line ("Strange things are afoot...");

This does seem like a lot of typing but don't worry: Ada allows you to declare shorter aliasnames if you need a long statement very often.