Difference between revisions of "ReNamer:Pascal Script:Quick guide"
Line 49: | Line 49: | ||
end; | end; | ||
− | | [[Image:PascalScriptIfThen.png]] | + | | [[Image:PascalScriptIfThen.png|center]] |
|- | |- | ||
| <center>'''If-then-else'''</center> | | <center>'''If-then-else'''</center> | ||
Line 65: | Line 65: | ||
end; | end; | ||
− | | [[Image:PascalScriptIfThenElse.png]] | + | | [[Image:PascalScriptIfThenElse.png|center]] |
|- | |- | ||
| <center>'''for'''</center> | | <center>'''for'''</center> | ||
Line 75: | Line 75: | ||
end; | end; | ||
− | | [[Image:PascalScriptForLoop.png]] | + | | [[Image:PascalScriptForLoop.png|center]] |
|- | |- | ||
| <center>'''while'''</center> | | <center>'''while'''</center> | ||
Line 85: | Line 85: | ||
end; | end; | ||
− | | [[Image:PascalScriptWhileLoop.png]] | + | | [[Image:PascalScriptWhileLoop.png|center]] |
|- | |- | ||
| <center>'''case/switch'''</center> <center>'''(exclusive)'''</center> | | <center>'''case/switch'''</center> <center>'''(exclusive)'''</center> | ||
Line 111: | Line 111: | ||
<br> end; | <br> end; | ||
− | | [[Image:PascalScriptCase.png]] | + | | [[Image:PascalScriptCase.png|center]] |
|- | |- | ||
| <center>'''case/switch'''</center> <center>'''(fall-through)'''</center> | | <center>'''case/switch'''</center> <center>'''(fall-through)'''</center> | ||
Line 137: | Line 137: | ||
<br> end; | <br> end; | ||
− | | [[Image:PascalScriptCaseWithFallThrough.png]] | + | | [[Image:PascalScriptCaseWithFallThrough.png|center]] |
|- | |- | ||
| <center>'''Repeat until'''</center> | | <center>'''Repeat until'''</center> | ||
Line 145: | Line 145: | ||
until <condition>; | until <condition>; | ||
− | | [[Image:PascalScriptRepeatUntilLoop.png]] | + | | [[Image:PascalScriptRepeatUntilLoop.png|center]] |
|- | |- | ||
| <center>'''Break'''</center> | | <center>'''Break'''</center> |
Revision as of 18:33, 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; |
||
if <condition> then
begin <Action-1> end else begin <Action-2> end; |
||
for I:=x to y do
begin <Action> end; |
||
while <condition> do
begin <Action> end; |
||
case x of
<Action-1> Break end;
<Action-2> Break end;
<Default Action> end;
|
||
case x of
<Action-1> end;
<Action-2> end;
<Default Action> end;
|
||
repeat
<Action> until <condition>; |
||