Difference between revisions of "ReNamer:Pascal Script:Quick guide"
Jump to navigation
Jump to search
Line 28: | Line 28: | ||
All the typical control structures (building blocks) occurring in Pascal Script are described in the following table. | 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. | + | 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: | In actual implementation, just substitute the following: | ||
Line 49: | Line 49: | ||
end; | end; | ||
− | | [[Image:]] | + | | [[Image:PascalScriptIfThen.png]] |
|- | |- | ||
| <center>'''If-then-else'''</center> | | <center>'''If-then-else'''</center> | ||
Line 65: | Line 65: | ||
end; | end; | ||
− | | [[Image:]] | + | | [[Image:PascalScriptIfThenElse.png]] |
|- | |- | ||
| <center>'''for'''</center> | | <center>'''for'''</center> | ||
Line 75: | Line 75: | ||
end; | end; | ||
− | | [[Image:]] | + | | [[Image:PascalScriptForLoop.png]] |
|- | |- | ||
| <center>'''while'''</center> | | <center>'''while'''</center> | ||
Line 85: | Line 85: | ||
end; | end; | ||
− | | [[Image:]] | + | | [[Image:PascalScriptWhileLoop.png]] |
|- | |- | ||
| <center>'''case/switch'''</center> <center>'''(exclusive)'''</center> | | <center>'''case/switch'''</center> <center>'''(exclusive)'''</center> | ||
| case x of | | case x of | ||
− | + | <br> 1: begin | |
− | |||
− | 1: begin | ||
<Action-1> Break | <Action-1> Break | ||
Line 113: | Line 111: | ||
<br> end; | <br> end; | ||
− | | [[Image:]] | + | | [[Image:PascalScriptCase.png]] |
|- | |- | ||
| <center>'''case/switch'''</center> <center>'''(fall-through)'''</center> | | <center>'''case/switch'''</center> <center>'''(fall-through)'''</center> | ||
Line 139: | Line 137: | ||
<br> end; | <br> end; | ||
− | | [[Image:]] | + | | [[Image:PascalScriptCaseWithFallThrough.png]] |
|- | |- | ||
| <center>'''Repeat until'''</center> | | <center>'''Repeat until'''</center> | ||
Line 147: | Line 145: | ||
until <condition>; | until <condition>; | ||
− | | [[Image:]] | + | | [[Image:PascalScriptRepeatUntilLoop.png]] |
|- | |- | ||
| <center>'''Break'''</center> | | <center>'''Break'''</center> | ||
− | | | + | | <br> |
− | | | + | | <br> |
|- | |- | ||
| <center>'''Continue'''</center> | | <center>'''Continue'''</center> | ||
− | | | + | | <br> |
− | | | + | | <br> |
|- | |- | ||
| <center>'''Exit'''</center> | | <center>'''Exit'''</center> | ||
− | | | + | | <br> |
− | | | + | | <br> |
|} | |} |
Revision as of 18:31, 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.