CONST
Source: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgConst Last revised: 2017-09-18
Declares unchanging constant data.
Syntax
Const symbolname1 [As DataType] = value1 [, symbolname2 [As DataType] = value2, ...]or
Const [As DataType] symbolname1 = value1 [, symbolname2 = value2, ...]Description
Declares unchanging constant data — either integer, decimal (floating-point) or string. If DataType is not explicitly given, the constant type will be inferred.
String * size, Zstring * size, or Wstring * size are not allowed as DataType. Specifying String as DataType is tolerated but has no effect, since the resulting type is always Zstring * size.
Constants follow visibility rules similar to variables, for namespace blocks, type blocks and compound block statements.
Examples
vb
Const Red = RGB(252, 2, 4)
Const Black As UInteger = RGB(0, 0, 0)
Const Text = "This is red text on a black bkgnd."
Locate 1, 1
Color Red, Black
Print Text
Sleep
EndDifferences from QB
- QB does not support the
As datatypesyntax.