Skip to main content

Constantes

Constantes​

Constantes numéricas​

As constantes numéricas são quaisquer algarismos, precedidos de um sinal de menos opcional para indicar números negativos, e de um ponto decimal opcional seguido de mais algarismos para indicar valores decimais. Há dois tipos de números: 1) inteiros e 2) números decimais.

Exemplos:

Números inteiros
10
-2345
0

Os valores inteiros positivos também podem ser escritos em binário (base 2), octal (base 8) e hexadecimal (base 16). Os valores binários começam por 0b (0b1110 = 14), os octais por 0o (0o177 = 127) e os hexadecimais por 0x (0xff = 255).

Números decimais
-234.567
56.87
0.0123
PI

Números muito grandes ou muito pequenos também podem ser representados em notação científica E (acrescentada na versão 0.9.9.46). https://pt.wikipedia.org/wiki/Nota%C3%A7%C3%A3o_cient%C3%ADfica

Notação científica E
Notação ENúmero decimal
2e02
3e2300
1.234e1012340000000
-5.3e4-53000
2e-10.2
5.12e-90.00000000512

Constantes de string​

As constantes de string são zero ou mais caracteres entre aspas (“) ou entre plicas (’).

Exemplos​

‘I said “Hello.”’
“Tuesday Rocks”
‘123’
“it is Smith’s”

Constantes booleanas​

Os valores booleanos representam os dois valores verdadeiro e falso. Estão definidas as constantes true e false, que representam os valores 1 e 0, respetivamente. Num teste, qualquer número diferente de zero é verdadeiro, e uma string é verdadeira a não ser que esteja vazia.

Exemplos​

Valores verdadeirosValores falsos
TRUEFALSE
10
-560.0
9.9“” (string vazia)
“something”

Constantes de cor e valores RGB​

Estes valores são usados pela instrução Color, podem ser criados com RGB e são devolvidos pelas funções GetBrushColor, GetColor e pixel.

Constante de cor (nome)Valores ARGBInteiro
BLACK255, 0, 0, 04278190080Black
WHITE255, 255, 255, 2554294967295White
RED255, 255, 0, 04294901760red
DARKRED255, 128, 0, 04286578688darkred
GREEN255, 0, 255, 04278255360green
DARKGREEN255, 0, 128, 04278222848darkgreen
BLUE255, 0, 0, 2554278190335blue
DARKBLUE255, 0, 0, 1284278190208darkblue
CYAN255, 0, 255, 2554278255615cyan
DARKCYAN255, 0, 128, 1284278222976darkcyan
PURPLE255, 255, 0, 2554294902015purple
DARKPURPLE255, 128, 0, 1284286578816darkpurple
YELLOW255, 255, 255, 04294967040yellow
DARKYELLOW255, 128, 128 ,04286611456darkyellow
ORANGE255, 255, 102, 04294927872orange
DARKORANGE255, 176, 61 ,04289740032darkorange
GREY / GRAY255, 164, 164 ,1644288980132grey
DARKGREY / DARKGRAY255, 128, 128 ,1284286611584darkgrey
CLEAR0, 0, 0, 00

Tipos de variáveis e de expressões​

Estas constantes representam os valores numéricos devolvidos pela função TypeOf.

Valores devolvidos
ConstanteValorTipo
TYPE_UNASSIGNED0Variável sem valor
TYPE_INT1Inteiro
TYPE_FLOAT2Número decimal
TYPE_STRING3String
TYPE_ARRAY4Variável array
TYPE_REF5Referência a variável
TYPE_MAP6Map

Códigos de erro e constantes​

Esta é a lista dos números de erro de execução devolvidos pela função LastError e das mensagens de erro devolvidas pela função LastErrorMessage. As mensagens aparecem em inglês, tal como o BASIC-256 as mostra.

Erros que não podem ser apanhados​
Erro #Descrição do erro
-1ERROR_NOSUCHLABELNo such label %VARNAME%
-2ERROR_NEXTNOFORNext without FOR
-3ERROR_NOTARRAYVariable %VARNAME% is not an array
-5ERROR_ARGUMENTCOUNTNumber of arguments passed does not match FUNCTION/SUBROUTINE definition
-6ERROR_MAXRECURSEMaximum levels of recursion exceeded
-7ERROR_STACKUNDERFLOWStack Underflow Error
-8ERROR_BADCALLFUNCTIONFunction was not called correctly
-9ERROR_BADCALLSUBROUTINESubroutine was not called correctly
Erros que podem ser apanhados​
Erro #Descrição do erro
5ERROR_FILENUMBERInvalid File Number
6ERROR_FILEOPENUnable to open file
7ERROR_FILENOTOPENFile not open
8ERROR_FILEWRITEUnable to write to file
9ERROR_FILERESETUnable to reset file
10ERROR_ARRAYSIZELARGEArray %VARNAME% dimension too large
11ERROR_ARRAYSIZESMALLArray %VARNAME% dimension too small
13ERROR_VARNOTASSIGNEDVariable %VARNAME% has not been assigned a value
14ERROR_ARRAYNITEMSArray %VARNAME% rows must have the same number of items
15ERROR_ARRAYINDEXArray %VARNAME% index out of bounds
17ERROR_STRSTARTStarting position less than zero
20ERROR_RGBRGB Color values must be in the range of 0 to 255
21ERROR_PUTBITFORMATString input to putbit incorrect
23ERROR_POLYPOINTSNot enough points in array for poly()/stamp()
24ERROR_IMAGEFILEUnable to load image file
25ERROR_SPRITENUMBERSprite number out of range
26ERROR_SPRITENASprite has not been assigned
27ERROR_SPRITESLICEUnable to slice image
28ERROR_FOLDERInvalid directory name
29ERROR_INFINITYOperation returned infinity
30ERROR_DBOPENUnable to open SQLITE database
31ERROR_DBQUERYDatabase query error (message follows)
32ERROR_DBNOTOPENDatabase must be opened first
33ERROR_DBCOLNOColumn number out of range or column name not in data set
34ERROR_DBNOTSETRecord set must be opened first
35ERROR_TYPECONVUnable to convert string to number
36ERROR_NETSOCKError opening network socket
37ERROR_NETHOSTError finding network host
38ERROR_NETCONNUnable to connect to network host
39ERROR_NETREADUnable to read from network connection
40ERROR_NETNONENetwork connection has not been opened
41ERROR_NETWRITEUnable to write to network connection
42ERROR_NETSOCKOPTUnable to set network socket options
43ERROR_NETBINDUnable to bind network socket
44ERROR_NETACCEPTUnable to accept network connection
45ERROR_NETSOCKNUMBERInvalid Socket Number
46ERROR_PERMISSIONYou do not have permission to use this statement/function
47ERROR_IMAGESAVETYPEInvalid image save type
50ERROR_DIVZERODivision by zero
51ERROR_BYREFFunction/Subroutine expecting variable reference in call
53ERROR_FREEFILEThere are no free file numbers to allocate
54ERROR_FREENETThere are no free network connections to allocate
55ERROR_FREEDBThere are no free database connections to allocate
56ERROR_DBCONNNUMBERInvalid Database Connection Number
57ERROR_FREEDBSETThere are no free data sets to allocate for that database connection
58ERROR_DBSETNUMBERInvalid data set number
59ERROR_DBNOTSETROWYou must advance the data set using DBROW before you can read data from it
60ERROR_PENWIDTHDrawing pen width must be a non-negative number
62ERROR_ARRAYINDEXMISSINGArray variable %VARNAME% has no value without an index
63ERROR_IMAGESCALEImage scale must be greater than or equal to zero
64ERROR_FONTSIZEFont size, in points, must be greater than or equal to zero
65ERROR_FONTWEIGHTFont weight must be greater than or equal to zero
66ERROR_RADIXSTRINGUnable to convert radix string back to a decimal number
67ERROR_RADIXRadix conversion base muse be between 2 and 36
68ERROR_LOGRANGEUnable to calculate the logarithm or root of a negative number
69ERROR_STRINGMAXLENString exceeds maximum length of 16,777,216 characters
71ERROR_PRINTERNOTONPrinter is not on
72ERROR_PRINTERNOTOFFPrinting is already on
73ERROR_PRINTEROPENUnable to open printer
74ERROR_WAVFILEFORMATMedia file does not exist or in an unsupported format
75ERROR_WAVNOTOPENMedia file not open
76ERROR_WAVNOTSEEKABLE
77ERROR_WAVNODURATION
78ERROR_FILEOPERATIONCan not perform that operation on a Serial Port
79ERROR_SERIALPARAMETERInvalid serial port parameter
80ERROR_LONGRANGENumber exceeds long integer range ()
81ERROR_INTEGERRANGENumber exceeds integer range ()
65535ERROR_NOTIMPLEMENTED“Feature not implemented in this environment.”
Avisos​
Erro #Descrição do erro
65536+ERROR_TYPECONVWARNING_TYPECONVUnable to convert string to number, zero used
65536+ERROR_WAVNOTSEEKABLEWARNING_WAVNOTSEEKABLEMedia file is not seekable
65536+ERROR_WAVNODURATIONWARNING_WAVNODURATIONDuration is not available for media file
65536+ERROR_VARNOTASSIGNEDWARNING_VARNOTASSIGNEDVariable %VARNAME% has not been assigned a value
65536+ERROR_LONGRANGEWARNING_LONGRANGENumber exceeds long integer range ()
65536+ERROR_INTEGERRANGEWARNING_INTEGERRANGENumber exceeds integer range ()

Constantes dos botões do rato​

Estas constantes representam os valores numéricos devolvidos pelas funções Clickb e Mouseb. Se o utilizador tiver premido mais do que um botão, os valores devolvidos são somados.

Valores devolvidos
ConstanteValor
MOUSEBUTTON_NONE0
MOUSEBUTTON_LEFT1
MOUSEBUTTON_RIGHT2
MOUSEBUTTON_CENTER4
MOUSEBUTTON_DOUBLECLICK32

Constantes de tipo de imagem a guardar​

Estas constantes indicam à instrução ImgSave em que formato deve guardar a janela de gráficos.

Valores devolvidos
ConstanteValor
IMAGETYPE_BMP“BMP”
IMAGETYPE_JPG“JPG”
IMAGETYPE_PNG“PNG”

Constantes de tipo de sistema operativo​

Estas constantes representam os valores numéricos devolvidos pela função OsType.

Valores devolvidos
ConstanteValor
OSTYPE_WINDOWS0
OSTYPE_LINUX1
OSTYPE_MACINTOSH2
OSTYPE_ANDROID3

Constantes de GetSlice​

Estas constantes indicam o que faz a instrução GetSlice.

Valores das camadas gráficas
ConstanteValor
SLICE_ALL0
SLICE_PAINT1
SLICE_SPRITE2

Ligações para páginas separadas​