switched typeof for oftype, switched typeas for astype

This commit is contained in:
2022-09-07 14:47:57 +01:00
parent 6c71a16e3e
commit 4137b7f057
10 changed files with 28 additions and 28 deletions

View File

@@ -31,7 +31,7 @@ DONE: are compounds shallow or deep copies? Deep copies
DONE: third output stream, for lexer/parser/compiler/interpreter errors
DONE: Assertion-based test scripts
DONE: Import/export keywords
DONE: A way to check the type of a variable (typeOf keyword)
DONE: A way to check the type of a variable (oftype keyword)
DONE: slice and dot notation around the builtin _index and _dot functions

View File

@@ -24,6 +24,7 @@ The following list of keywords cannot be used as names, due to their significanc
* any
* as
* astype
* assert
* bool
* break
@@ -44,13 +45,12 @@ The following list of keywords cannot be used as names, due to their significanc
* int
* null
* of
* oftype
* print
* return
* string
* true
* type
* typeas
* typeof
* var
* while
@@ -118,11 +118,11 @@ var t: type = int;
var u: t = 42;
```
To force a type instead of an array, use the `typeas` keyword:
To force a type instead of an array, use the `astype` keyword:
```
var a = [typeas type]; //array of types
var b = typeas [type]; //type of array of types
var a = [type]; //array containing the type "type"
var b = astype [type]; //type of array of types
var d = b; //types can be re-assigned to other variables
```