Added standard library page, other tweaks

This commit is contained in:
2022-10-16 21:12:39 +11:00
committed by GitHub
parent f1cb3ce352
commit c310235247
4 changed files with 95 additions and 1 deletions

View File

@@ -23,6 +23,8 @@ var f = 3.14;
var s = "Hello world";
```
See [Reserved Keywords](#reserved-keywords) for a list of keywords that can't be used as a name.
## Compounds
Larger containers of data are available - arrays and dictionaries. Arrays are collections of data stored sequentially, while dictionaries are hash-maps of key-value pairs:
@@ -169,3 +171,59 @@ assert answer == 42, "This will not be seen";
assert null, "This will be seen before the script exits";
```
## Reserved Keywords
The following list cannot be used as names, due to their significance (or potential later use) in the language.
* any
* as
* astype
* assert
* bool
* break
* class (reserved)
* const
* continue
* do (reserved)
* else
* export
* false
* float
* fn
* for
* foreach (reserved)
* if
* import
* in (reserved)
* int
* null
* of (reserved)
* print
* return
* string
* true
* type
* typeof
* var
* while
## Full List of Operators
The following mathematical operators are available. A definition is omitted here, as they are commonly used in most programming languages.
```
+ - * / % += -= *= /= %= ++(prefix) --(prefix) (postfix)++ (postfix)--
```
Likewise, the following logical operators are available (`&&` is more tightly bound than `||` due to historical reasons):
```
( ) [ ] { } ! != == < > <= >= && ||
```
Other operators used throughout the language are: the assignment, colon, semicolon, comma, dot and rest operators:
```
= : ; , . ...
```