Previous topic |
Next topic |
Ada Home Page |
Index
Procedures
Example
procedure show_answer is
-- display the result of adding two numbers
begin -- show_answer
NEW_LINE;
PUT ( "The total is .... ");
PUT ( total_num );
NEW_LINE;
end show_answer;
procedure call:
- write its name
- include arguments in brackets
procedure must be visible:
- declared earlier
- included via WITH
Procedure call and return
procedure call:
- remember where up to in the calling code
- transfer to called procedure
- set up storage for local variables
- associate parameters with values
- start execution at first statement of callee
-
procedure finishes executing:
- wind up called procedure
- return values through parameters
- dispose of storage
- pick up where left off in caller
Previous topic |
Next topic |
Ada Home Page |
Index
c-lokan@adfa.oz.au / 15 Feb 96