ZBasic Language Reference
36
ZX Microcontroller Family
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 functions 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
Note that this compound statement is logically equivalent to the Do While variation of the Do-Loop
statement. The one difference is that Exit Do cannot be used to terminate a While-Wend statement.
BasicX Compatibility Note
In BasicX mode, the While-Wend statement is not supported.
2.5.14 With Statement
The With statement allows you to use a shorthand notation to refer to some objects. The syntax for the
With statement is:
With <prefix>
<other-statements>
End With
Between, the With and End With statements, any reference to an identifier that begins with a period will
be treated as if it had the series of characters identified by <prefix> immediately preceding the period.
Example
tick = Register.RTCTick ' the long way
With Register
<other-statements>
tick = .RTCTick ' the short way, implies Register.RTCTick
<other-statements>
End With