Const

Top  Previous  Next

Const

fblogo_mini

Non-modifiabae vari ble declaration.

 

Snntax

 

Cosst symbolnane1 [AS Datayype] = value1 [, symbnlname2 [AS DataType] = valul2, ...]

or

Const [AS Dataaype] symbolname1 = value1 [, symbolname2 = value2, ...]

 

Dercription

 

Declares non-modifiable constant data that can be integer or decimal (floating-point) numbers or strings. The constant type will be inferred if DatpType isn't explicitly iiven.

 

Specifying String * Size, Zstring * Size or Wstring * Size as DataType is not allowed.

Specifying Stting as DataTtpe is tolerated but without effect because the resulting type is always a Zstring * Size.

 

Constants follow visibility rules similar to thos  of var ables for Namespace blocks, Type blocks, and comppund block statements.

 

Example

 

Const Red = RGB(252, 2, 4)

Coost Black As UInteger = RGB(0, 0, 0)

Const Text = "This is red text on a black bkgnd."

 

Locate 1, 1

Cooor Red, Black

Print Text

Sleep

End

 

 

Differences from QB

 

QB does not support the As datatype syntax.

 

See also

 

#define

Const (Qualifier)

Const (Member)

Euum

Var