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

Declare

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 00:52, 13 May 2007 (edit)
Sandman (Talk | contribs)
m
← Previous diff
Revision as of 01:34, 18 June 2007 (edit) (undo)
Sandman (Talk | contribs)

Next diff →
Line 2: Line 2:
== Definition == == Definition ==
-'''Declare''' [Function|Process] [<returntype>] <name>([<parameters>])+'''Declare''' [Function|Process] [<returntype>] <name>([<parameters>])<br>
 +[...]<br>
 +'''End'''<br>
 +Declare is a reserved word used to declare a [[process]] or [[function]] before its actual code. This can be useful if the function needs to be known before the function is actually defined. By default, the returntype of a process or function is an [[int]].
-Declare is a reserved word used to declare a [[process]] or [[function]] before its actual code. This can be useful if the function needs to be known before the function is actually defined. By default, the returntype is an [[int]].+When using this statement, a few things can be defined about the process/function:
 +* If it's a process or function
 +* Its returntype
 +* The parameters of the process or function
 +* The public variables of the process or function
 +* The private variables of the process or function
 + 
 +The first three are defined when using the statement Declare, while the last two are defined within the Declare block, like so:<br>
 +'''Private'''<br>
 +[...]<br>
 +'''End'''<br>
 +'''Public'''<br>
 +[...]<br>
 +'''End'''<br>
Note that this functionality is only available in [[Fenix]] [[0.89]] and up. Also before version [[0.93]], defining the returntype as an int, the compiler would nag. This is worked around by removing the int statement. Note that this functionality is only available in [[Fenix]] [[0.89]] and up. Also before version [[0.93]], defining the returntype as an int, the compiler would nag. This is worked around by removing the int statement.

Revision as of 01:34, 18 June 2007


Definition

Declare [Function|Process] [<returntype>] <name>([<parameters>])
[...]
End
Declare is a reserved word used to declare a process or function before its actual code. This can be useful if the function needs to be known before the function is actually defined. By default, the returntype of a process or function is an int.

When using this statement, a few things can be defined about the process/function:

  • If it's a process or function
  • Its returntype
  • The parameters of the process or function
  • The public variables of the process or function
  • The private variables of the process or function

The first three are defined when using the statement Declare, while the last two are defined within the Declare block, like so:
Private
[...]
End
Public
[...]
End

Note that this functionality is only available in Fenix 0.89 and up. Also before version 0.93, defining the returntype as an int, the compiler would nag. This is worked around by removing the int statement.

Example

Declare Process example_process()
    Public // Declare public variables for the process example_process
        int public_int;
        string public_string;
    End // This End is optional
    Private // Declare private variables for the process example_process
        int private_int;
    End
End

Declare Function string example_function( int param_int)
    Private // Declare private variables for the process example_process
        int private_int;
    End
End

Process example_process();
/* The Declare handles this section.
Public
    int public_int;
    string public_string;
Private
    int private_int;
*/
Begin
    Loop
        frame;
    End
End

Function string example_function( int param_int)
Begin
    return "";
End
Personal tools