- This wiki is out of date, use the continuation of this wiki instead
Function
From FenixWiki
(Difference between revisions)
Revision as of 23:24, 25 March 2007 (edit) Sandman (Talk | contribs) m ← Previous diff |
Revision as of 23:29, 25 March 2007 (edit) (undo) Sandman (Talk | contribs) Next diff → |
||
Line 1: | Line 1: | ||
+ | == Definition == | ||
A function is a [[subroutine]] to which one or more of the following apply:<br /> | A function is a [[subroutine]] to which one or more of the following apply:<br /> | ||
*it received [[parameters]]<br /> | *it received [[parameters]]<br /> | ||
*it acts on the [[parameters]]<br /> | *it acts on the [[parameters]]<br /> | ||
*it processes [[data]] located elsewhere<br /> | *it processes [[data]] located elsewhere<br /> | ||
- | *it [[returns]] a value<br /> | + | *it [[return|returns]] a value<br /> |
- | A function does not create a new thread, and therefore the [[process]] which called the function waits until the function is completed before continuing executing its code. | + | A function does not create a new thread, and therefore the [[process]] which [[call|called]] the function waits until the function is completed before continuing executing its code. |
As opposed to a [[process]], a function doesn't have a [[frame]]; statement. See [[process]] for more information. | As opposed to a [[process]], a function doesn't have a [[frame]]; statement. See [[process]] for more information. | ||
+ | |||
+ | == Example == | ||
+ | <pre> | ||
+ | int addInts( int a , int b ) | ||
+ | Begin | ||
+ | return a+b; | ||
+ | End | ||
+ | </pre> | ||
+ | addInts(3,6); will return 9. One can see that the function does indeed: | ||
+ | *receives [[parameters]] | ||
+ | *acts on the [[parameters]] | ||
+ | *[[|return|returns]] a value |
Revision as of 23:29, 25 March 2007
Definition
A function is a subroutine to which one or more of the following apply:
- it received parameters
- it acts on the parameters
- it processes data located elsewhere
- it returns a value
A function does not create a new thread, and therefore the process which called the function waits until the function is completed before continuing executing its code.
As opposed to a process, a function doesn't have a frame; statement. See process for more information.
Example
int addInts( int a , int b ) Begin return a+b; End
addInts(3,6); will return 9. One can see that the function does indeed:
- receives parameters
- acts on the parameters
- [[|return|returns]] a value