summaryrefslogtreecommitdiff
path: root/Statement vs expression.md
diff options
context:
space:
mode:
Diffstat (limited to 'Statement vs expression.md')
-rw-r--r--Statement vs expression.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/Statement vs expression.md b/Statement vs expression.md
new file mode 100644
index 0000000..e899857
--- /dev/null
+++ b/Statement vs expression.md
@@ -0,0 +1,9 @@
+[[Rust]]
+[[A scope block is an expression]]
+[[How to return from a function]]
+[[Adding a semicolon to the end of a line turns it into a statement]]
+[[It is not possible to do a chain assignment]]
+[[An empty tuple is called a unit]]
+
+An expression returns something, ie `1 + 2` returns `3`.
+A statement on the other hand does not return anything: as assignment is a statement. It equals to the unit! \ No newline at end of file