This commit is contained in:
2025-05-17 19:57:24 -05:00
parent bbb8985074
commit c9ce5fb5ed

View File

@@ -5,8 +5,6 @@ date = 2025-05-08T22:23:44-05:00
This is a book for my language found [here](https://crosslang.tesseslanguage.com/)
## Statements and loops
@@ -25,6 +23,25 @@ var myVariable = 42;
myVariable = "I have set the variable to a string";
```
#### Reflective variables
```js
var nameOfVariable = "Var 1";
.[nameOfVariable] = 42; //the variable name in this instance will be Var 1
Console.WriteLine(.[nameOfVariable]); //prints 42
var nameOfVariable2 = "Var 2";
var nameOfField = "This field has spaces and \n New Lines";
.[nameOfVariable2] = {
.[nameOfField] = "Hello, world"
};
Console.WriteLine(.[nameOfVariable2].[nameOfField]); //should print Hello, world
```
#### If statements
The {} are optional if you only need one statement
@@ -118,7 +135,7 @@ do(conditionLikeIf)
#### Try statement
Note: you can't yield, return, break or continue from inside a try statement (also applys to catch and finally due to these being internally closures)
NOTE: you can't return undefined (but you can return other types) (It will just return from try and will still execute the body past the try statement) due to the try statement being a closure (you can still break and continue due to special TObjects being returned)
```js
try {
@@ -583,3 +600,26 @@ myHtml = <null>Hello</null>; //would just be Hello (useful for templating as it
myHtml = <raw(stringExpr)>; //allowing you to emit unescaped html from string into html litteral (useful for templating)
```