doc/tutorial/basics: various improvements
- added section for templates
- updated ambiguity in bottom.md
- several small fixes
Change-Id: Iac03e7b99eec1ea352cb30d815a8cfbfb6896b18
diff --git a/doc/tutorial/basics/coalesce.md b/doc/tutorial/basics/coalesce.md
index 41fbfce..3a487a0 100644
--- a/doc/tutorial/basics/coalesce.md
+++ b/doc/tutorial/basics/coalesce.md
@@ -11,12 +11,20 @@
In the example the fallback values are specified
for `a` and `b` in case the list index is out of bounds.
+To do actual null coalescing one can unify a result with the desired type
+to force an error.
+In that case the default will be used if either the lookup fails or
+the result is not of the desired type.
+
<!-- CUE editor -->
```
list: [ "Cat", "Mouse", "Dog" ]
a: list[0] | "None"
b: list[5] | "None"
+
+n: [null]
+v: n[0] & string | "default"
```
<!-- result -->
@@ -25,4 +33,6 @@
a: "Cat"
b: "None"
+n: [null]
+v: "default"
```
\ No newline at end of file