EnableArrayIndexCheck Function | |
Suppress Array Index check to be compatible with Visual Objects
In some situations Visual Objects did not throw a runtime error when you were accessing a non existing array element.
You can enable this (mis)behaviour in X# by disabling the array index checks.
The default behavior is to generate an error when you access array indices out of the existing range.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION EnableArrayIndexCheck(
lCheck AS LOGIC
) AS LOGIC
public static bool EnableArrayIndexCheck(
bool lCheck
)
Request Example
View SourceParameters
- lCheck
- Type: Logic
TRUE to enable the array index checks.
Return Value
Type:
LogicThe previous setting of the flag
Examples
// The following code does not throw a runtime error but displays NIL for u[1,1]
// To get the same behavior in X# you need to call EnableArrayIndexCheck(FALSE)
FUNCTION Start
LOCAL u AS USUAL
u := {1,2,3}
? u[1,1]
WAIT
RETURN TRUE
See Also