Const Statement


Const name = expression

Assigns a symbolic name to a constant value.

A constant must be defined before it is used.  

The definition of a Const in BlueZone Basic outside the procedure or at the module level is a global.  The syntax Global Const and Const are used below outside the module level are identical.

A type declaration character may be used however if none is used BlueZone Basic will automatically assign one of the following data types to the constant, long (if it is a long or integer), Double (if a decimal place is present), or a String ( if it is a string).

Example:

    Global Const Height = 14.4357

    Const PI = 3.14159   'Global to all procedures in a module

 

    Sub Main()

        Begin Dialog DialogName1 60, 60, 160,70, "ASC - Hello"

            TEXT 10, 10, 100, 20, "Please fill in the radius of circle x"

            TEXT 10, 40, 28, 12, "Radius"

            TEXTBOX 42, 40, 28, 12, .Radius

            OKBUTTON 42, 54,40, 12

        End Dialog

 

        Dim Dlg1 As DialogName1

        Dialog Dlg1

        CylArea = Height * (Dlg1.Radius * Dlg1.Radius) * PI

        MsgBox "The volume of Cylinder x is " & CylArea

    End Sub