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

Program

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 13:23, 24 July 2007 (edit)
Sandman (Talk | contribs)
m
← Previous diff
Current revision (23:44, 8 August 2008) (edit) (undo)
Sandman (Talk | contribs)

 
(2 intermediate revisions not shown.)
Line 5: Line 5:
[[Basic statements|'''Up to Basic Statements''']] [[Basic statements|'''Up to Basic Statements''']]
---- ----
 +
== Definition == == Definition ==
-'''PROGRAM''' <programname>;+'''Program''' <programname>;
Program is a reserved word used to begin your program. It's not needed to start a program with it. Program is a reserved word used to begin your program. It's not needed to start a program with it.
 +
 +It should be noted that this is for backwards compatibility only; the use of <code>[[Process]] Main()</code> is the proper way.
== Example == == Example ==
Line 20: Line 23:
End // End the main code End // End the main code
</pre> </pre>
-When the [[End]] of the main code is reached, the program exits, if there are no [[process]]es alive anymore.+When the [[End]] of the main code is reached, the program exits, if there are no [[process]]es alive anymore, which is logical, as Fenix quits when there are no processes running and Program is a process as well. As the matter of fact, you can leave the whole Program business out and throw in a process called ''Main'', which will be called when the program is started:
 +<pre>
 +Process Main() // This process is started when the program is started
 +Begin // Start the main code
 + Loop
 + frame;
 + End
 +End // End the main code
 +</pre>
 +This process is just like any other process with the addition it gets called when the program starts. This means that you can also [[call]] the process using <code>main()</code>. The funny thing is, when you use [[program]], this will call that 'process' as well.

Current revision

Up to Basic Statements



[edit] Definition

Program <programname>;

Program is a reserved word used to begin your program. It's not needed to start a program with it.

It should be noted that this is for backwards compatibility only; the use of Process Main() is the proper way.

[edit] Example

Program example; // Name this program "example", which doesn't really matter
Begin // Start the main code
    Loop
        frame;
    End
End // End the main code

When the End of the main code is reached, the program exits, if there are no processes alive anymore, which is logical, as Fenix quits when there are no processes running and Program is a process as well. As the matter of fact, you can leave the whole Program business out and throw in a process called Main, which will be called when the program is started:

Process Main() // This process is started when the program is started
Begin // Start the main code
    Loop
        frame;
    End
End // End the main code

This process is just like any other process with the addition it gets called when the program starts. This means that you can also call the process using main(). The funny thing is, when you use program, this will call that 'process' as well.

Personal tools