- This wiki is out of date, use the continuation of this wiki instead
Begin
From FenixWiki
(Difference between revisions)
Revision as of 12:41, 24 July 2007 (edit) Sandman (Talk | contribs) (added OnExit) ← Previous diff |
Revision as of 12:53, 24 July 2007 (edit) (undo) Sandman (Talk | contribs) Next diff → |
||
Line 3: | Line 3: | ||
== Definition == | == Definition == | ||
- | '''Begin''' | + | '''Begin'''<br> |
+ | <main code><br> | ||
+ | ['''OnExit'''<br> | ||
+ | <exit code>]<br> | ||
+ | '''End''' | ||
Begin is a reserved word to indicate the start of the code part of a [[program]] or a [[process]]. The end is indicated by [[End]]. | Begin is a reserved word to indicate the start of the code part of a [[program]] or a [[process]]. The end is indicated by [[End]]. | ||
Line 16: | Line 20: | ||
Local // Start a global variables part of the program | Local // Start a global variables part of the program | ||
End | End | ||
- | Private // Start a private variables part of the | + | Private // Start a private variables part of the main process |
End | End | ||
- | Begin // Start the code part of the | + | Begin // Start the main code part of the main process |
proc1(); // create new instance of proc1 | proc1(); // create new instance of proc1 | ||
Loop | Loop | ||
frame; | frame; | ||
End | End | ||
+ | OnExit // Start the exit code part of the main process | ||
End | End | ||
Line 30: | Line 35: | ||
End | End | ||
Local // Start a global variables part of the program | Local // Start a global variables part of the program | ||
- | End | ||
- | Private // Start a private variables part of the program | ||
End | End | ||
Process proc1() | Process proc1() | ||
+ | Public // Start the public variables part of the process | ||
Private // Start the private variables part of the process | Private // Start the private variables part of the process | ||
- | + | Begin // Start the main code part of the process | |
- | Begin // Start the code part of the process | + | |
Loop | Loop | ||
frame; | frame; | ||
End | End | ||
- | OnExit // Start the | + | OnExit // Start the exit code part of the process |
End | End | ||
</pre> | </pre> | ||
Line 47: | Line 50: | ||
Global, constant, local and private parts of the program can be scattered through the code, between processes and functions. Sometimes the End can be left out, but it's good practice to keep it in. When a variable or constant is declared, it's only viewable or editable for statements ''beneath'' the declaration. For more info on that, see [[prototyping]]. | Global, constant, local and private parts of the program can be scattered through the code, between processes and functions. Sometimes the End can be left out, but it's good practice to keep it in. When a variable or constant is declared, it's only viewable or editable for statements ''beneath'' the declaration. For more info on that, see [[prototyping]]. | ||
+ | |||
+ | Note that when [[Declare]] is used, the [[Public variable]]s have to be declared in the Declare block and not in the process block |
Revision as of 12:53, 24 July 2007
Definition
Begin
<main code>
[OnExit
<exit code>]
End
Begin is a reserved word to indicate the start of the code part of a program or a process. The end is indicated by End.
Example
Program example; Global // Start a global variables part of the program End Const // Start a constants part of the program End Local // Start a global variables part of the program End Private // Start a private variables part of the main process End Begin // Start the main code part of the main process proc1(); // create new instance of proc1 Loop frame; End OnExit // Start the exit code part of the main process End Global // Start a global variables part of the program End Const // Start a constants part of the program End Local // Start a global variables part of the program End Process proc1() Public // Start the public variables part of the process Private // Start the private variables part of the process Begin // Start the main code part of the process Loop frame; End OnExit // Start the exit code part of the process End
Used in example: loop, end, onexit, process
Global, constant, local and private parts of the program can be scattered through the code, between processes and functions. Sometimes the End can be left out, but it's good practice to keep it in. When a variable or constant is declared, it's only viewable or editable for statements beneath the declaration. For more info on that, see prototyping.
Note that when Declare is used, the Public variables have to be declared in the Declare block and not in the process block