Section 1.3 - Use Clauses

Some programs might be very wordy if you had to always specify where a procedure is defined in order to use it. Thus, Ada provides the use clause. Whenever you use a procedure (or something else) but do not specify where it is defined, the Ada compiler will search all units listed in applicable use clauses. Use clauses follow the with clause, begin with the keyword use, and then list the library units to be searched. Here's how that first program would look with a use clause:


Verbose Configure


Quiz:

If, in this new version of the program, you changed the second-to-last-line back to:
Ada.Text_IO.Put_Line("Hello, world!");
would the program still work?

  1. Yes
  2. No

You may also:

PREVIOUS Go back to the previous section

NEXT     Skip to the next section

OUTLINE  Go up to lesson 1 outline

David A. Wheeler (dwheeler@ida.org)

The master copy of this file is at "http://www.adahome.com/Tutorials/Lovelace/s1s3.htm".