Skip to content

Commit 1b66e70

Browse files
committed
upd: lazily commit on June 2nd, 2026 4:32 PM UTC -0700 by lily
1 parent a2fb245 commit 1b66e70

3 files changed

Lines changed: 55 additions & 13 deletions

File tree

docs/functions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
Declaring a function in ADAN will be like the following:
44

55
```adan
6-
func example(<Params>): <type>? {
6+
func example(<Params>): <Type>? {
77
88
}
99
```
1010

11-
- `<type>?` Refers to an *optional* type, if no type is provided, one will be inferred by the function's result.
12-
- - If no type is provided, `: <type>?` can be fully omitted.
11+
- `<Type>?` Refers to an *optional* type, if no type is provided, one will be inferred by the function's result.
12+
- - If no type is provided, `: <Type>?` can be fully omitted.
1313

14-
After a function is defined, it is callable using the `<name>(<params>);` syntax:
14+
After a function is defined, it is callable using the `<Name>(<Params>);` syntax:
1515

1616
```adan
1717
func example(): Integer ... # Let's say this returns `1`.

docs/loops.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,49 @@ A for-in loop is a kind of loop that can optionally save the `key` *and* the `va
1313
1414
## <...>? = <...> (local variable) OR _ (no variable)
1515
16-
for <key>?, <value>? in <loop> {
16+
for <Key>?, <Value>? in <Loop> {
1717
...
1818
}
19+
```
20+
21+
### Entry-Controlled For Loop
22+
23+
An entry-controlled for loop is a type of loop that allows you to change the starting position in the array.
24+
25+
For example, we can do: `for var i = 0; ...; ... { ... }`, where `0` is the position we start at in the array.
26+
27+
> If we set it to `3` for example, our loop would *start* in the *fourth* index of the array.
28+
29+
```adan
30+
# Syntax
31+
32+
for <Init>?; <Condition>?; <Iterate --/++>? {
33+
...
34+
}
35+
```
36+
37+
If every field is left empty (for ; ; ; { ... }), the loop would run indefinitely.
38+
39+
### While Loops
40+
41+
While loops by design, repeat indefinitely while the condition provided equates to true. Once false, the loop will break, never repeating again.
42+
43+
```adan
44+
# Syntax
45+
46+
while <Condition> {
47+
...
48+
}
49+
```
50+
51+
### Exit-Controlled Loop
52+
53+
Unlike entry-controlled for loops, exit-controlled loops are styled similarly to while loops, where they check the condition first, *then*, and only if true, they run the code, exit-controlled loops run the code *first*, ***and then*** check the condition to validate if it should continue.
54+
55+
```adan
56+
# Syntax
57+
58+
repeat {
59+
...
60+
} until <Condition>;
1961
```

docs/variables.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ Variables can be read only (immutable) using the `readonly` keyword beforehand.
99
```adan
1010
var a = 1;
1111
12-
var b: <type>? = 1;
12+
var b: <Type>? = 1;
1313
1414
a = 2;
1515
16-
readonly var c: <type>? = 1;
16+
readonly var c: <Type>? = 1;
1717
```
1818

19-
- `<type>?` Refers to an *optional* type, if no type is provided, one will be inferred by the variable's result.
20-
- - If no type is provided, `: <type>?` can be fully omitted.
19+
- `<Type>?` Refers to an *optional* type, if no type is provided, one will be inferred by the variable's result.
20+
- - If no type is provided, `: <Type>?` can be fully omitted.
2121

2222
Unlike *most modern languages* (**i.e.** JavaScript, Python, etc.), variables are capable of starting with integers.
2323

@@ -55,16 +55,16 @@ In conclusion, here are all of the various ways variables may be defined:
5555
```adan
5656
var a = 1;
5757
58-
var b: <type>? = 1;
58+
var b: <Type>? = 1;
5959
6060
a = 2; # Assigning an existing variable a new value.
6161
# Cannot declare variables this way.
6262
63-
readonly var c: <type>? = 1;
63+
readonly var c: <Type>? = 1;
6464
65-
global var d: <type>? = 1;
65+
global var d: <Type>? = 1;
6666
67-
global readonly var e: <type>? = 1;
67+
global readonly var e: <Type>? = 1;
6868
6969
global d = 2;
7070
```

0 commit comments

Comments
 (0)