EasyManua.ls Logo

Kollmorgen AKD Basic

Kollmorgen AKD Basic
506 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
AKD BASIC User Guide | 6 AKD BASIC Parameters, Operators, Statements
6.1.18 Static
General Information
Type Statement
Description
The Static statement is used in a Function, Sub or Interrupt to specify that the
specified variable's value be remembered even when the Function or Sub is fin-
ished.
Units N/A
Range N/A
Default
Value
N/A
Data Type N/A
Start Ver-
sion
TBD
Description
The Static statement is used in a Function, Sub or Interrupt to specify that the specified var-
iable's value be remembered even when the Function or Sub is finished. The next time that the
Function, Sub or Interrupt is executed, the value will be available.
Example
This example illustrates the difference between using Dim and Static in a Sub procedure. 'x'
always gets reset to zero, while 'y' continually gets incremented.
Main
while 1
call MySub
pause(1)
wend
End Main
Sub MySub
dim x as integer 'value is forgotten
static y as integer 'value is remem-
bered
x = x + 1
y = y + 1
print x,y
End Sub
Related Topics
Dim | Sub...End Sub | Function | Interrupt...End Interrupt
Kollmorgen | March 30, 2012 116

Table of Contents

Related product manuals