Make a local forward declaration
- Last Updated: October 15, 2024
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
If you use the FORWARD keyword in the function
prototype, then this tells the AVM to expect the actual function
implementation later in the same procedure file. This is a simple
example of a function that converts temperature measurements in
degrees Celsius scale to degrees Fahrenheit:
|
This procedure executes as follows:
- The procedure makes a forward declaration of the
CtoFconversion function, so that it can be used in the procedure before its implementation code is defined. - The function is used inside the
REPEATloop in theDISPLAYstatement. Notice that it appears where anyDECIMALexpression could appear and is treated the same way. - There is the actual implementation of the function, which takes the temperature as measured in degrees Celsius as input and returns the equivalent temperature measurement in degrees Fahrenheit.
The following figure shows the first page of output from the h-ConvTemp1.p procedure.
You could leave the parameter list out of the function implementation itself, but it is good form to leave it in.