This wiki is out of date, use the continuation of this wiki instead

Function

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 21:34, 7 May 2007 (edit)
84.82.73.239 (Talk)
(Example)
← Previous diff
Revision as of 15:09, 12 May 2007 (edit) (undo)
Sandman (Talk | contribs)
m
Next diff →
Line 4: Line 4:
== Definition == == Definition ==
-A function is a [[subroutine]] to which one or more of the following apply:<br />+ 
-*it receives [[parameters]]<br />+=== Statement ===
-*it acts on the parameters<br />+'''Function''' <returntype> <name>([<parameters>]);
-*it processes [[data]] located elsewhere<br />+ 
-*it [[return]]s a [[value]]<br />+Function is a reserved word used to start the code of a function.
 + 
 +=== Concept ===
 +A function is a [[subroutine]] to which one or more of the following apply:
 +*it receives [[parameters]]
 +*it acts on the parameters
 +*it processes [[data]] located elsewhere
 +*it [[return]]s a [[value]]
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. 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.
Line 18: Line 25:
== Example == == Example ==
<pre> <pre>
-int addInts( int a , int b )+Function int addInts( int a , int b )
-Begin+Private // Declare private variables here
 +Begin // Start the main functioncode
return a+b; return a+b;
-End+End // End the main functioncode
</pre> </pre>
addInts(3,6); will return 9. One can see that the function does indeed: addInts(3,6); will return 9. One can see that the function does indeed:

Revision as of 15:09, 12 May 2007


Contents

Definition

Statement

Function <returntype> <name>([<parameters>]);

Function is a reserved word used to start the code of a function.

Concept

A function is a subroutine to which one or more of the following apply:

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.

For a list of functions, see this list of functions.

Example

Function int addInts( int a , int b )
Private // Declare private variables here
Begin // Start the main functioncode
    return a+b;
End // End the main functioncode

addInts(3,6); will return 9. One can see that the function does indeed:

  • receive parameters.
  • act on the parameters.
  • return a value.
Personal tools