You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and start writing Monkey lang code. The results of the statements will be printed in the stdout. For example:
15
+
16
+
```
17
+
>> 3 * 7
18
+
21
19
+
>> let x = 3 * 7
20
+
>> x
21
+
21
22
+
```
23
+
24
+
Note that some statements like variable bindings don't print anything in the stdout.
15
25
16
26
## Language specs
17
27
28
+
### Types
29
+
30
+
There are 5 types supported:
31
+
32
+
- Booleans: `true` or `false`
33
+
- Integers: `1`, `-1`, `12345`...
34
+
- Strings: `"Hello World"`
35
+
- Arrays: `[1, 2, 3]`. You can access a given position of an array by using indexes: `[1, 2, 3][1]` or `myArray[1]`.
36
+
- Hashes: `{"a": 1, 5: "test", true: "bool"}`
37
+
18
38
### Operators
19
39
20
-
- Bang (!): it takes any input and returns the opposite. For example `!true = false` and `!5 = false`, as `5` acts as "truthy". However, `!!5` would be `true` as it's the same as `!false`.
40
+
#### Prefix expressions
41
+
42
+
- Bang (`!`): it takes any input and returns the opposite. For example `!true = false` and `!5 = false`, as `5` acts as "truthy". However, `!!5` would be `true` as it's the same as `!false`.
43
+
- Minus (`-`): changes the sign of an integer e.g. `-5`.
0 commit comments