<< Click to Display Table of Contents >> Navigation: Concordance Programming Fundamentals > Writing a Function > About CPL Functions |
In CPL, a function is a re-usable procedure within an application. Functions exist because, very often, you may need to perform certain tasks multiple times. Or, they exist because they can act as reasonable abstractions for certain tasks.
The following script declares and uses the Multiply_X_by_Y CPL function, which will be analyzed in the following topics:
main() { int myValue; int valOne; int valTwo;
valOne = 10; valTwo = 5;
myValue = Multiply_X_by_Y(valOne, valTwo); }
Multiply_X_by_Y(int x, int y) { int z; z = x * y; return(z); |
Topic |
Description |
Discussion of how the main() function starts off the entire CPL script. |
|
How to begin and end a function. |
|
How to declare and use variables in a function. |
|
How to write a function. |
|
How to return a value from a function call. |
|
How to call a function from another function, such as main(). |
|
Discusses the built-in CPL functions. |