Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Arithmetical Functions
Arithmetic Operators
Array Declaration
Assignment Operators
Binary Data Representation
Bits Manipulation Functions
Character Test Functions
Comparison methods
Complex numbers
Constant Declaration
Constant Expression
Conversion Functions
Datatype Functions
Date & Time Functions
Enumeration declaration
Error Management
Event Loop
Event Management
Events declaration
External Function Management
File & Directory Functions
File & Directory Paths
File mode syntax
Floating Point Numbers
Formatting functions
Gambas Object Model
Global Special Event Handlers
Integer numbers
Intrinsic Functions
Language Constants
Localization and Translation Functions
Local Variable Declaration
Logarithms & Exponentials Functions
Logical Operators
Loop Control Structures
Method Declaration
Miscellaneous Control Structures
Miscellaneous Functions
Native Arrays
Native Container Classes
Object & Class Management
Operator Evaluation Order
Predefined Constants
Process Management
Property Declaration
Random Numbers Functions
Special Methods
Stream & Input/Output functions
String Functions
String Operators
Structure declaration
Test Control Structures & Functions
Trigonometric Functions
User-defined formats
Using reserved keywords as identifiers
Variable Declaration
Last Changes
Search the wiki
To Do
Wiki License
Wiki Manual

Constant Declaration

{ PUBLIC | PRIVATE } CONST Identifier AS Datatype = ConstantValue

This keyword declares a class global constant.

This constant is accessible everywhere in the class it is declared.

If the PUBLIC keyword is specified, it will be also accessible to the other classes having a reference to an object of this class.

Constant datatype can be: Boolean, Integer, Long, Float or String.

Since 3.17

Integer constants can also be defined with a constant expression.


Public Const MAX_FILE As Integer = 30

Private Const Debug AS Boolean = True

Private Const MAGIC_HEADER As String = "# Gambas form file"

See also