Difference between revisions of "ReNamer:Pascal Script:Quick guide"
(Created page with '=== Basic control flow in a pascal script === <tt>'''PROGRAM'''</tt> <tt>'' ProgramName'' (''FileList'')''';'''</tt> <tt>'''CONST'''...') |
|||
Line 1: | Line 1: | ||
=== Basic control flow in a pascal script === | === Basic control flow in a pascal script === | ||
− | <tt>'''PROGRAM'''</tt> | + | <tt>'''PROGRAM'''</tt> |
− | <tt>'' ProgramName'' (''FileList'')''';'''</tt> | + | <tt>'' ProgramName'' (''FileList'')''';'''</tt> |
− | <tt>'''CONST''' </tt> | + | <tt>'''CONST''' </tt> <tt> </tt> |
− | <tt> <''Constant declarations>''</tt> | + | <tt> <''Constant declarations>''</tt> |
− | + | '''TYPE''' <tt> </tt> | |
− | <tt> | + | <tt> <''Type declarations>''</tt> |
<tt>'''VAR'''</tt> | <tt>'''VAR'''</tt> | ||
− | <tt> <''Variable declarations>'' </tt> | + | <tt> <''Variable declarations>''</tt> |
− | <tt> <''definitions of subprogram>''</tt> | + | <tt></tt> <tt> <''definitions of subprogram>''</tt> |
− | + | '''BEGIN''' | |
+ | <tt> <''Executable statements>''</tt> | ||
− | + | <tt>'''END.'''</tt> | |
− | |||
− | <tt>'''END.''' </tt> | ||
=== Control Structures === | === Control Structures === |
Revision as of 18:16, 9 July 2009
Basic control flow in a pascal script
PROGRAM
ProgramName (FileList);
CONST
<Constant declarations>
TYPE
<Type declarations>
VAR
<Variable declarations>
<definitions of subprogram>
BEGIN <Executable statements>
END.
Control Structures
All the typical control structures (building blocks) occurring in Pascal Script are described in the following table.
The table shows a flow chart and Pascal Script code required to implement that logic. You can simnply copy and paste these blocks and then edit them to finish your script.
In actual implementation, just substitute the following:
- Replace <condition> with an actual Pascal statement that tests for a condition.
- Replace <Action> with code block that takes action relevant to the condition.
if <condition> then
begin <Action> end; |
[[Image:]] | |
if <condition> then
begin <Action-1> end else begin <Action-2> end; |
[[Image:]] | |
for I:=x to y do
begin <Action> end; |
[[Image:]] | |
while <condition> do
begin <Action> end; |
[[Image:]] | |
case x of
<Action-1> Break end;
<Action-2> Break end;
<Default Action> end;
|
[[Image:]] | |
case x of
<Action-1> end;
<Action-2> end;
<Default Action> end;
|
[[Image:]] | |
repeat
<Action> until <condition>; |
[[Image:]] | |