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-notatie | Decimaal getal |
| 2e0 | 2 |
| 3e2 | 300 |
| 1.234e10 | 12340000000 |
| -5.3e4 | -53000 |
| 2e-1 | 0.2 |
| 5.12e-9 | 0.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 waarden | Onware waarden |
|---|---|
| TRUE | FALSE |
| 1 | 0 |
| -56 | 0.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-waarden | Geheel getal | |
|---|---|---|---|
| BLACK | 255, 0, 0, 0 | 4278190080 | |
| WHITE | 255, 255, 255, 255 | 4294967295 | |
| RED | 255, 255, 0, 0 | 4294901760 | |
| DARKRED | 255, 128, 0, 0 | 4286578688 | |
| GREEN | 255, 0, 255, 0 | 4278255360 | |
| DARKGREEN | 255, 0, 128, 0 | 4278222848 | |
| BLUE | 255, 0, 0, 255 | 4278190335 | |
| DARKBLUE | 255, 0, 0, 128 | 4278190208 | |
| CYAN | 255, 0, 255, 255 | 4278255615 | |
| DARKCYAN | 255, 0, 128, 128 | 4278222976 | |
| PURPLE | 255, 255, 0, 255 | 4294902015 | |
| DARKPURPLE | 255, 128, 0, 128 | 4286578816 | |
| YELLOW | 255, 255, 255, 0 | 4294967040 | |
| DARKYELLOW | 255, 128, 128 ,0 | 4286611456 | |
| ORANGE | 255, 255, 102, 0 | 4294927872 | |
| DARKORANGE | 255, 176, 61 ,0 | 4289740032 | |
| GREY / GRAY | 255, 164, 164 ,164 | 4288980132 | |
| DARKGREY / DARKGRAY | 255, 128, 128 ,128 | 4286611584 | |
| CLEAR | 0, 0, 0, 0 | 0 |
Types van variabelen en uitdrukkingen
Deze constanten staan voor de getallen die de functie TypeOf teruggeeft.
| Teruggegeven waarden | ||
|---|---|---|
| Constante | Waarde | Type |
| TYPE_UNASSIGNED | 0 | Variabele zonder waarde |
| TYPE_INT | 1 | Geheel getal |
| TYPE_FLOAT | 2 | Decimaal getal |
| TYPE_STRING | 3 | String |
| TYPE_ARRAY | 4 | Tabelvariabele |
| TYPE_REF | 5 | Verwijzing naar een variabele |
| TYPE_MAP | 6 | Map |
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 | |
| -1 | ERROR_NOSUCHLABEL | No such label %VARNAME% |
| -2 | ERROR_NEXTNOFOR | Next without FOR |
| -3 | ERROR_NOTARRAY | Variable %VARNAME% is not an array |
| -5 | ERROR_ARGUMENTCOUNT | Number of arguments passed does not match FUNCTION/SUBROUTINE definition |
| -6 | ERROR_MAXRECURSE | Maximum levels of recursion exceeded |
| -7 | ERROR_STACKUNDERFLOW | Stack Underflow Error |
| -8 | ERROR_BADCALLFUNCTION | Function was not called correctly |
| -9 | ERROR_BADCALLSUBROUTINE | Subroutine was not called correctly |
Fouten die je kan opvangen
| Fout # | Beschrijving van de fout | |
| 5 | ERROR_FILENUMBER | Invalid File Number |
| 6 | ERROR_FILEOPEN | Unable to open file |
| 7 | ERROR_FILENOTOPEN | File not open |
| 8 | ERROR_FILEWRITE | Unable to write to file |
| 9 | ERROR_FILERESET | Unable to reset file |
| 10 | ERROR_ARRAYSIZELARGE | Array %VARNAME% dimension too large |
| 11 | ERROR_ARRAYSIZESMALL | Array %VARNAME% dimension too small |
| 13 | ERROR_VARNOTASSIGNED | Variable %VARNAME% has not been assigned a value |
| 14 | ERROR_ARRAYNITEMS | Array %VARNAME% rows must have the same number of items |
| 15 | ERROR_ARRAYINDEX | Array %VARNAME% index out of bounds |
| 17 | ERROR_STRSTART | Starting position less than zero |
| 20 | ERROR_RGB | RGB Color values must be in the range of 0 to 255 |
| 21 | ERROR_PUTBITFORMAT | String input to putbit incorrect |
| 23 | ERROR_POLYPOINTS | Not enough points in array for poly()/stamp() |
| 24 | ERROR_IMAGEFILE | Unable to load image file |
| 25 | ERROR_SPRITENUMBER | Sprite number out of range |
| 26 | ERROR_SPRITENA | Sprite has not been assigned |
| 27 | ERROR_SPRITESLICE | Unable to slice image |
| 28 | ERROR_FOLDER | Invalid directory name |
| 29 | ERROR_INFINITY | Operation returned infinity |
| 30 | ERROR_DBOPEN | Unable to open SQLITE database |
| 31 | ERROR_DBQUERY | Database query error (message follows) |
| 32 | ERROR_DBNOTOPEN | Database must be opened first |
| 33 | ERROR_DBCOLNO | Column number out of range or column name not in data set |
| 34 | ERROR_DBNOTSET | Record set must be opened first |
| 35 | ERROR_TYPECONV | Unable to convert string to number |
| 36 | ERROR_NETSOCK | Error opening network socket |
| 37 | ERROR_NETHOST | Error finding network host |
| 38 | ERROR_NETCONN | Unable to connect to network host |
| 39 | ERROR_NETREAD | Unable to read from network connection |
| 40 | ERROR_NETNONE | Network connection has not been opened |
| 41 | ERROR_NETWRITE | Unable to write to network connection |
| 42 | ERROR_NETSOCKOPT | Unable to set network socket options |
| 43 | ERROR_NETBIND | Unable to bind network socket |
| 44 | ERROR_NETACCEPT | Unable to accept network connection |
| 45 | ERROR_NETSOCKNUMBER | Invalid Socket Number |
| 46 | ERROR_PERMISSION | You do not have permission to use this statement/function |
| 47 | ERROR_IMAGESAVETYPE | Invalid image save type |
| 50 | ERROR_DIVZERO | Division by zero |
| 51 | ERROR_BYREF | Function/Subroutine expecting variable reference in call |
| 53 | ERROR_FREEFILE | There are no free file numbers to allocate |
| 54 | ERROR_FREENET | There are no free network connections to allocate |
| 55 | ERROR_FREEDB | There are no free database connections to allocate |
| 56 | ERROR_DBCONNNUMBER | Invalid Database Connection Number |
| 57 | ERROR_FREEDBSET | There are no free data sets to allocate for that database connection |
| 58 | ERROR_DBSETNUMBER | Invalid data set number |
| 59 | ERROR_DBNOTSETROW | You must advance the data set using DBROW before you can read data from it |
| 60 | ERROR_PENWIDTH | Drawing pen width must be a non-negative number |
| 62 | ERROR_ARRAYINDEXMISSING | Array variable %VARNAME% has no value without an index |
| 63 | ERROR_IMAGESCALE | Image scale must be greater than or equal to zero |
| 64 | ERROR_FONTSIZE | Font size, in points, must be greater than or equal to zero |
| 65 | ERROR_FONTWEIGHT | Font weight must be greater than or equal to zero |
| 66 | ERROR_RADIXSTRING | Unable to convert radix string back to a decimal number |
| 67 | ERROR_RADIX | Radix conversion base muse be between 2 and 36 |
| 68 | ERROR_LOGRANGE | Unable to calculate the logarithm or root of a negative number |
| 69 | ERROR_STRINGMAXLEN | String exceeds maximum length of 16,777,216 characters |
| 71 | ERROR_PRINTERNOTON | Printer is not on |
| 72 | ERROR_PRINTERNOTOFF | Printing is already on |
| 73 | ERROR_PRINTEROPEN | Unable to open printer |
| 74 | ERROR_WAVFILEFORMAT | Media file does not exist or in an unsupported format |
| 75 | ERROR_WAVNOTOPEN | Media file not open |
| 76 | ERROR_WAVNOTSEEKABLE | |
| 77 | ERROR_WAVNODURATION | |
| 78 | ERROR_FILEOPERATION | Can not perform that operation on a Serial Port |
| 79 | ERROR_SERIALPARAMETER | Invalid serial port parameter |
| 80 | ERROR_LONGRANGE | Number exceeds long integer range () |
| 81 | ERROR_INTEGERRANGE | Number exceeds integer range () |
| 65535 | ERROR_NOTIMPLEMENTED | “Feature not implemented in this environment.” |
Waarschuwingen
| Fout # | Beschrijving van de fout | |
| 65536+ERROR_TYPECONV | WARNING_TYPECONV | Unable to convert string to number, zero used |
| 65536+ERROR_WAVNOTSEEKABLE | WARNING_WAVNOTSEEKABLE | Media file is not seekable |
| 65536+ERROR_WAVNODURATION | WARNING_WAVNODURATION | Duration is not available for media file |
| 65536+ERROR_VARNOTASSIGNED | WARNING_VARNOTASSIGNED | Variable %VARNAME% has not been assigned a value |
| 65536+ERROR_LONGRANGE | WARNING_LONGRANGE | Number exceeds long integer range () |
| 65536+ERROR_INTEGERRANGE | WARNING_INTEGERRANGE | Number 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 | |
|---|---|
| Constante | Waarde |
| MOUSEBUTTON_NONE | 0 |
| MOUSEBUTTON_LEFT | 1 |
| MOUSEBUTTON_RIGHT | 2 |
| MOUSEBUTTON_CENTER | 4 |
| MOUSEBUTTON_DOUBLECLICK | 32 |
Constanten voor afbeeldingstypes
Met deze constanten vertel je de opdracht ImgSave in welk formaat het grafische venster bewaard moet worden.
| Teruggegeven waarden | |
|---|---|
| Constante | Waarde |
| 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 | |
|---|---|
| Constante | Waarde |
| OSTYPE_WINDOWS | 0 |
| OSTYPE_LINUX | 1 |
| OSTYPE_MACINTOSH | 2 |
| OSTYPE_ANDROID | 3 |
Constanten voor GetSlice
Met deze constanten geef je aan wat de opdracht GetSlice moet doen.
| Grafische lagen | |
|---|---|
| Constante | Waarde |
| SLICE_ALL | 0 |
| SLICE_PAINT | 1 |
| SLICE_SPRITE | 2 |