diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-09-07 07:33:13 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-09-07 07:33:13 +0100 |
commit | 48896c56c39344fa429260d3969eccc93ef8035c (patch) | |
tree | ff4b278f6a685abae64ad0139fb94835088048b1 /language.md | |
parent | 781e2803e9cebef1c0282b9a73ebdafab055fc52 (diff) | |
download | micro-lang-hs-48896c56c39344fa429260d3969eccc93ef8035c.tar.gz micro-lang-hs-48896c56c39344fa429260d3969eccc93ef8035c.zip |
Some docs on operators
Diffstat (limited to 'language.md')
-rw-r--r-- | language.md | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/language.md b/language.md index ec0a425..4044ad1 100644 --- a/language.md +++ b/language.md @@ -354,7 +354,25 @@ TODO: a zero ended array of u8 with special initializers ## Operators -TODO +Micro2 uses the same operators and almost the same operator precedence as C, from more to less priority: + +``` +! - ~ +/ * % +& +- + +<< >> | ^ +> >= < <= +|| && +!= == += +``` + +Arithmetic operators only apply to integers. + +Comparison operators only apply to integers, with the exception of `==` and `!=` that also apply to other types (if both operands are of the same type). + +Logic operators apply to booleans and they are lazy operators (e.g. in `a && b`, `b` won't be evaluated if `a` is false). ## Flow control |