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 01:34, 18 June 2007 (edit)
Sandman (Talk | contribs)

← Previous diff
Revision as of 13:03, 24 July 2007 (edit) (undo)
Sandman (Talk | contribs)

Next diff →
Line 22: Line 22:
'''End'''<br> '''End'''<br>
 +== Notes ==
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.
 +
 +When the Declare statement is used for a [[function]]/[[process]] and the process has [[public variable]]s, they need to be declared in the Declare block. Else the compiler will nag it expected BEGIN.
== Example == == Example ==

Revision as of 13:03, 24 July 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

Notes

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.

When the Declare statement is used for a function/process and the process has public variables, they need to be declared in the Declare block. Else the compiler will nag it expected BEGIN.

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