Format
Examples
For counter = start To/Down end [Step
steps ]
[Statements]
Next [counter]
For n = 100 Down 0 Step 3
n = n * 2
Next n
For loop = 0 To 20 Step 2
loop = (loop + 1) *2
Next loop
While – Wend statement
Loop an unknown number of times. Looping is controlled by the Condition. When Condition is TRUE, the
statements will be executed repetitively until the condition turns to FALSE.
Condition
Necessary. An expression which evaluates to TRUE or FALSE.
Statements
Optional. Statement block.
break
Used in looping control or select statement. It skips immediately to the end of the statement.
continue
Used in looping control statement. It quits the current iteration of a loop and starts the next one.
return
Returns to the function or module that called the current function.
Format
Examples
While [
Condition
]
[Statements]
Wend
For n = 100 Down 0 Step 3
n = n * 2
Next n
For loop = 0 To 20 Step 2
loop = (loop + 1) *2
Next loop
Boolean ex pres sions:
The value of Boolean expression is zero means FALSE.
The value of Boolean expression is not zero means TRUE.
Function calls and passing parameters
A sub-function must be defined before its execution and is therefore placed before the main() macro function. If
there is an entry attempt into a function before it is first defined in the macro program will create a compiler error
‘Function not defined’.
Sub int SQR(int x) //This is the sub-function that squares a
number
x = x * x
return x
1010-1001a, Rev 02
Mac ros
255
Содержание Silver HMI504T
Страница 1: ...1010 1001A Rev 02...
Страница 20: ...1010 1001a Rev 02 16 Silver Series Installation Operation Manual OIT to PC Serial Port Pin Assignments...
Страница 32: ...1010 1001a Rev 02 28 Silver Series Installation Operation Manual...
Страница 128: ...1010 1001a Rev 01 124 Silver Series Installation Operation Manual...
Страница 156: ...1010 1001a Rev 02 152 Silver Series Installation Operation Manual...
Страница 166: ...1010 1001a Rev 02 162 Silver Series Installation Operation Manual...
Страница 216: ...1010 1001a Rev 01 212 Silver Series Installation Operation Manual...
Страница 251: ...1010 1001a Rev 02 Macros 247 Set Bit Objects Attributes Dialog Project Example of Add 2...
Страница 264: ...End Macro_Command 1010 1001a Rev 02 260 Silver Series Installation Operation Manual...
Страница 268: ...1010 1001a Rev 01 264 Silver Series Installation Operation Manual...