diff --git a/src/pages/learn/basics/variables.mdx b/src/pages/learn/basics/variables.mdx
index 7f222b0..9ac9178 100644
--- a/src/pages/learn/basics/variables.mdx
+++ b/src/pages/learn/basics/variables.mdx
@@ -29,6 +29,15 @@ val surname = "Doe"
val year_of_birth = 1984
`} />
+It's a compile error to attempt to modify it
+
+
+
+
+
### Datatype annotation
Written after the `val` keyword but before the variable name.
@@ -64,6 +73,8 @@ Defined with `var`, followed by a variable name and a value.
### Datatype annotation
diff --git a/src/pages/learn/classes/constructor.mdx b/src/pages/learn/classes/constructor.mdx
index b727b2a..0a8c6b4 100644
--- a/src/pages/learn/classes/constructor.mdx
+++ b/src/pages/learn/classes/constructor.mdx
@@ -67,6 +67,21 @@ class Dog(String name)
}
`} />
+This would be equilavent to the following PHP code:
+
+```php
+class Dog {
+ public string $name;
+ private int $name_len;
+
+ public function __construct(string $name) {
+ $this->name = $name;
+ $this->name_len = size($name);
+ print("Dog created: $name");
+ }
+}
+```
+
@@ -115,41 +130,33 @@ print(a2.name_length) //: 3
### Constructor that may fail
+A constructor may only fail if there is code
+that can fail on the `init` block.
+
+
+
TBD
Proposal 1:
- self!Error
-`} />
-
-Proposal 2:
-
-
-Proposal 3:
-
- self!Error
+ init -> Error!
{
- // Something that may fail
+ // Initialization code that may fail
}
}
`} />
-
## Destructor
The destructor in THP is the same as PHP.
The name of the class **MUST** begin with an uppercase letter.
+Classes have a parameter list even if they have no parameters
+for consistency sake.
## Instanciation
@@ -38,7 +40,7 @@ Properties are declared with `var`/`val` inside a block.
They **must** explicitly declare their datatype.
@@ -189,21 +191,3 @@ var michi = Animal("Michifu")
michi.set_name("Garfield")
`} />
-## Class constructor that may return an error
-
-Working theory:
-
-
-
-
-
diff --git a/src/pages/learn/classes/inheritance.mdx b/src/pages/learn/classes/inheritance.mdx
index 2ccd484..c5fbcb2 100644
--- a/src/pages/learn/classes/inheritance.mdx
+++ b/src/pages/learn/classes/inheritance.mdx
@@ -6,7 +6,7 @@ import Code from "../../../components/Code.astro"
# Inheritance
-
+A class inherits from another using the `extends` keyword.
+
+The call to the parent constructor is done right there, after
+the parent class name.
+
+
+
+You must always call super, even if the parent doesn't
+define any parameters:
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/learn/data-structures/arrays.mdx b/src/pages/learn/data-structures/arrays.mdx
index fb21e00..713df56 100644
--- a/src/pages/learn/data-structures/arrays.mdx
+++ b/src/pages/learn/data-structures/arrays.mdx
@@ -6,7 +6,10 @@ import Code from "../../../components/Code.astro"
# Arrays
-Use square brackets as usual.
+Arrays in THP use exclusively square brackets.
+
+More importantly, Arrays and Maps are different.
+Arrays only store values of a single datatype.
## Usage
@@ -16,7 +19,7 @@ val apple = fruits[0]
print(apple) // apple
-
+// To mutate an array, you need to declare it as var
var numbers = [0, 1, 2, 3]
numbers[3] = 5
diff --git a/src/pages/learn/flow-control/conditionals.mdx b/src/pages/learn/flow-control/conditionals.mdx
index b1cdce5..9ef5199 100644
--- a/src/pages/learn/flow-control/conditionals.mdx
+++ b/src/pages/learn/flow-control/conditionals.mdx
@@ -35,6 +35,8 @@ val result = if condition { value1 } else { value2 }
## Check for datatypes
+TBD
+
(B) function) -> Array[B]
diff --git a/src/pages/learn/functions/lambdas.mdx b/src/pages/learn/functions/lambdas.mdx
index 2d18872..2ece501 100644
--- a/src/pages/learn/functions/lambdas.mdx
+++ b/src/pages/learn/functions/lambdas.mdx
@@ -9,18 +9,48 @@ import Code from "../../../components/Code.astro"
## Anonymous function
+An anonymous function is declared with `fn`.
+Other than not having a name, it can declare parameter
+and return types.
+
Int {
+fn(Int x, Int y) -> Int {
x + y
}
+`} />
+Anonymous function can omit declaring those types as well:
+
+## Anonymous function short form
+
+If you need an anonymous function that returns a single
+expression you can write it like this:
+
+
+
+It uses an equal `=` instead of an arrow. It can contain
+only a single expression.
+
+This is common when declaring functions that immediately
+return a map.
+
+
+
+
+
## Closure types
diff --git a/src/pages/learn/functions/parameters.mdx b/src/pages/learn/functions/parameters.mdx
index f5d1769..09252e2 100644
--- a/src/pages/learn/functions/parameters.mdx
+++ b/src/pages/learn/functions/parameters.mdx
@@ -41,10 +41,11 @@ Placing a `mut` before the type makes the parameter a mutable
reference. Mutable methods can be used, and the original
data **can** be mutated.
-The caller *must* also use `mut`.
+The caller must define the value as `var`, and when calling
+must use `mut`.