From d09eb21096093c1df50a5932f84c74467202971f Mon Sep 17 00:00:00 2001
From: Matthias Koefferlein
-nil + x -> nil -x + nil -> x -nil + nil -> nil -+
| Expression | Result |
|---|---|
| nil + x | nil |
| x + nil | x |
| nil + nil | nil |
The same applies to the other binary operators "*", "/", "-", "&" "|", "<< and ">>". @@ -97,16 +98,17 @@ nil + nil -> nil The logical binary operators "||" and "&&" behave this way:
--x || y -> x if x is not "nil" or "false", y otherwise -x || nil -> x -nil || x -> x -nil || nil -> nil -x && y -> y if x is not "nil" or "false", x otherwise -x && nil -> nil -nil && x -> nil -nil && nil -> nil -+
| Expression | Result |
|---|---|
| x || y | x if x is not "nil" or "false", y otherwise |
| x || nil | x |
| nil || x | x |
| nil || nil | nil |
| x && y | y if x is not "nil" or "false", x otherwise |
| x && nil | nil |
| nil && x | nil |
| nil && nil | nil |