
Section 9. Program Control Instructions
SelectCase Example
The example uses SelectCase to decide what action to take based on user input.
Dim X, Y 'Declare variables.
If Not X = Y Then 'Are they equal
If X > Y Then
SelectCase X 'What is X.
Case 0 To 9 'Must be less than 10.
. . . . 'Run some code.
. . . . 'Run some code.
Case 10 To 99 'Must be less than 100.
. . . . 'Run some code.
. . . . 'Run some code.
CaseElse 'Must be something else.
. . . . 'Run some code.
EndSelect
EndIf
Else
SelectCase Y 'What is Y.
Case 1, 3, 5, 7, 9 'It's odd.
. . . . 'Run some code.
Case 0, 2, 4, 6, 8 'It's even.
. . . . 'Run some code.
CaseElse 'Out of range.
. . . . 'Run some code.
. . . . 'Run some code.
EndSelect
EndIf
. . . . 'Run some code.
. . . . 'Run some code.
SetSecurity (security[1], security[2], security[3])
Security[I] are constants. SetSecurity only executes at compile time.
If security[I] is 0 then security[>I] are set to 0 also.
Security[I] is in the range of 0..65535.
Highest level locks out all communication. The next locks out those that set
values or set the clock and program download and upload. The last level locks
out only the file upload and download.
We will coordinate this with a setting that is entered by the keyboard.
9-15
Kommentare zu diesen Handbüchern