Navigation bar
  Start Previous page
 38 of 156 
Next page End 33 34 35 36 37 38 39 40 41 42 43  

32
Case 4, 5 To 20, 27
    j = 1
    Call PutPin(13, zxOutputLow)
Case 3, 100, Is > 200, j
    j = 0
Case Else
    j = -1
End Select
In the example above, if the selection expression evaluates to 3 the statements of the first case clause
will be executed.  The fact that the third case clause also has a case value of 3 is of no consequence. 
Also note that the case expressions are evaluated every time they are tested.  This fact must be kept in
mind for two reasons.  Firstly, if the case expression contains a variable whose value changes between
successive executions of the Select-Case statement (a situation that is strongly discouraged), the case
clause that is selected may change even if the selection expression value does not change.  Secondly, if
any of the case clause expressions involves a function call, the function may or may not be invoked
depending on the value of the selection expression and the values of the various expressions in the case
clauses preceding it.
BasicX Compatibility Note
In BasicX mode, the use of String and Single types is not supported nor is the construction
Is <op> <expr>.  Moreover, there must be at least one standard case clause.
2.5.12 Set Statement
This statement is only allowed as the first statement of a function that returns an UnsignedInteger or
UnsignedLong type.  It must precede all other statements and variable definitions.  It is supported for
compatibility with BasicX and is required in BasicX compatibility mode but it is otherwise ignored.  The
syntax is shown below.
Set <function-name> = New <type>
The <function-name> element must match the name of the function containing the Set statement and
the <type> must match the function’s type.
Example
Function myFunc() as UnsignedInteger
    Set myFunc = New UnsignedInteger
    Dim I as Integer
    <other-statements>
End Function
2.5.13 While-Wend Statement
For compatibility with other dialects of Basic, ZBasic includes support for an alternative to the Do While –
Loop construct.  The syntax is:
While <boolean-expression>
[<statements>]
Wend
Previous page Top Next page