Skip to main content

Constanten

Constanten​

Numerieke constanten​

Numerieke constanten zijn reeksen cijfers, eventueel met een minteken ervoor voor negatieve getallen, en eventueel met een decimale punt en nog meer cijfers voor decimale getallen. Er zijn twee soorten getallen: 1) gehele getallen en 2) decimale getallen.

Enkele voorbeelden:

Gehele getallen
10
-2345
0

Positieve gehele getallen kan je ook schrijven in het binair (grondtal 2), het octaal (grondtal 8) en het hexadecimaal (grondtal 16). Zet 0b voor een binaire waarde (0b1110 = 14), 0o voor een octale waarde (0o177 = 127) en 0x voor een hexadecimale waarde (0xff = 255).

Decimale getallen
-234.567
56.87
0.0123
PI

Heel grote en heel kleine getallen kan je ook schrijven in de wetenschappelijke E-notatie (toegevoegd in versie 0.9.9.46). https://nl.wikipedia.org/wiki/Wetenschappelijke_notatie

Wetenschappelijke E-notatie
E-notatieDecimaal getal
2e02
3e2300
1.234e1012340000000
-5.3e4-53000
2e-10.2
5.12e-90.00000000512

Stringconstanten​

Stringconstanten zijn reeksen van nul of meer tekens tussen dubbele aanhalingstekens (“) of enkele aanhalingstekens (’).

Voorbeelden​

‘Ik zei “Hallo.”’
“Dinsdag is top”
‘123’
“het is van Smith”

Booleaanse constanten​

Booleaanse waarden zijn de twee waarden waar (true) en onwaar (false). De vaste constanten true en false staan voor de waarden 1 en 0. In een test is elk getal dat niet nul is waar, en een string is waar zodra hij niet leeg is.

Voorbeelden​

Ware waardenOnware waarden
TRUEFALSE
10
-560.0
9.9“” (lege string)
“iets”

Kleurconstanten en RGB-waarden​

Deze waarden gebruik je bij de opdracht Color, je kan ze maken met RGB, en de functies GetBrushColor, GetColor en pixel geven ze terug. Zie ook Kleurconstanten, waar ook de HSV-waarden staan.

Kleurconstante (naam)ARGB-waardenGeheel getal
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

Types van variabelen en uitdrukkingen​

Deze constanten staan voor de getallen die de functie TypeOf teruggeeft.

Teruggegeven waarden
ConstanteWaardeType
TYPE_UNASSIGNED0Variabele zonder waarde
TYPE_INT1Geheel getal
TYPE_FLOAT2Decimaal getal
TYPE_STRING3String
TYPE_ARRAY4Tabelvariabele
TYPE_REF5Verwijzing naar een variabele
TYPE_MAP6Map

Foutcodes en constanten​

Dit is de lijst met de nummers van de fouten tijdens de uitvoering die de functie LastError teruggeeft, en met de foutmeldingen die de functie LastErrorMessage teruggeeft. De meldingen blijven in het Engels, want zo toont BASIC-256 ze. Zie ook Foutcodes.

Fouten die je niet kan opvangen​
Fout #Beschrijving van de fout
-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
Fouten die je kan opvangen​
Fout #Beschrijving van de fout
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.”
Waarschuwingen​
Fout #Beschrijving van de fout
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 ()

Constanten voor de muisknoppen​

Deze constanten staan voor de getallen die de functies Clickb en Mouseb teruggeven. Heeft de gebruiker op meer dan één knop gedrukt, dan worden de waarden bij elkaar opgeteld.

Teruggegeven waarden
ConstanteWaarde
MOUSEBUTTON_NONE0
MOUSEBUTTON_LEFT1
MOUSEBUTTON_RIGHT2
MOUSEBUTTON_CENTER4
MOUSEBUTTON_DOUBLECLICK32

Constanten voor afbeeldingstypes​

Met deze constanten vertel je de opdracht ImgSave in welk formaat het grafische venster bewaard moet worden.

Teruggegeven waarden
ConstanteWaarde
IMAGETYPE_BMP“BMP”
IMAGETYPE_JPG“JPG”
IMAGETYPE_PNG“PNG”

Constanten voor het besturingssysteem​

Deze constanten staan voor de getallen die de functie OsType teruggeeft.

Teruggegeven waarden
ConstanteWaarde
OSTYPE_WINDOWS0
OSTYPE_LINUX1
OSTYPE_MACINTOSH2
OSTYPE_ANDROID3

Constanten voor GetSlice​

Met deze constanten geef je aan wat de opdracht GetSlice moet doen.

Grafische lagen
ConstanteWaarde
SLICE_ALL0
SLICE_PAINT1
SLICE_SPRITE2

Aparte pagina's​