To make an Ada program useful, you must add a source file to it. To create a source file:
This would create an empty file. In it, type the following: with Ada.Text_IO; use Ada.Text_IO; procedure Welcome is begin Put_Line("Welcome to Ada Programming"); end Welcome;
After typing the code, you must save the document. To do this:
If the file had not been saved before, this action would display the Save File As dialog box. Locate and select the folder that contains the project. Normally, a name will be suggested for the file and it should have the .adb extension (otherwise, make sure you provide this information):
Once you are ready, click Save. After creating a source file, you must add it to the project. To do this, on the main menu, click Project -> Edit Project Properties:
On the left list of buttons, click Main Files. In the Main Files section, click Add. In the Select Files dialog box, click the check box of the file you had saved:
Click OK:
Click OK.
To build the project, on the main menu, you can click Build, position the mouse on Project, and click either Build <current file> or the name of the file
This would display the Build Main dialog box:
Click Execute. The compiler would build the executable and display the result in the lower-right window:
Once a project has been built, to see its result, you must execute it. To execute the application, on the main menu, click Build, position the mouse on Run, and click the name of the file:
This would display the Arguments Selection dialog box:
Click OK. The result would appear in the lower-right window:
A comment is text that will not be considered when the project is built. Therefore, you can write anything you want as part of a comment. A comment starts with --. Anything on the right side of that, up to the end of the line, is considered a comment.
A pragma is something that asks the compiler to take a certain action, such as to import something from an external file. This is referred to as a directive. To create a pragma directive, start with the pragma keyword followed by the instruction. |
|
|||||||||||||
|