Nil
Sometimes you need to explicitly not return a value, this is when to use nil.
It is also what is returned from an empty closure or a closure whose last statement is a let declaration
- Knot
- TypeScript
knotconst empty = nil;
knotconst empty = nil;
tsxconst empty = undefined;
tsxconst empty = undefined;
Empty Closure
Empty closure expressions evaluate to nil.
- Knot
- TypeScript
knotconst result = {};
knotconst result = {};
tsxconst result = (function () {})();
tsxconst result = (function () {})();
Implicit Return
Closures that end in a let declaration implicitly return nil.
- Knot
- TypeScript
knotconst result = {let foo = "foo";};
knotconst result = {let foo = "foo";};
tsxconst result = (function () {let foo = "foo";})();
tsxconst result = (function () {let foo = "foo";})();