Skip to content

Commit c035807

Browse files
committed
Add operators
1 parent 38a6152 commit c035807

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

cheatsheets/gleam-for-javascript-users.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,32 @@ There is no performance cost to Gleam's labelled arguments as they are
316316
optimised to regular function calls at compile time, and all the arguments
317317
are fully type checked.
318318

319+
## Operators
320+
321+
| Operator | JavaScript | Gleam | Notes |
322+
| ----------------- | ---------- | ----- | ---------------------------------------------- |
323+
| Equal | `==` | `==` | In Gleam both values must be of the same type |
324+
| Strictly equal to | `===` | `==` | Comparison in Gleam is always strict |
325+
| Not equal | `!==` | `!=` | In Gleam both values must be of the same type |
326+
| Greater than | `>` | `>` | In Gleam both values must be **ints** |
327+
| Greater than | `>` | `>.` | In Gleam both values must be **floats** |
328+
| Greater or equal | `>=` | `>=` | In Gleam both values must be **ints** |
329+
| Greater or equal | `>=` | `>=.` | In Gleam both values must be **floats** |
330+
| Less than | `<` | `<` | In Gleam both values must be **ints** |
331+
| Less than | `<` | `<.` | In Gleam both values must be **floats** |
332+
| Less or equal | `<=` | `<=` | In Gleam both values must be **ints** |
333+
| Less or equal | `<=` | `<=.` | In Gleam both values must be **floats** |
334+
| Boolean and | `&&` | `&&` | In Gleam both values must be **bools** |
335+
| Boolean or | `||` | `||` | In Gleam both values must be **bools** |
336+
| Add | `+` | `+` | In Gleam both values must be **ints** |
337+
| Add | `+` | `+.` | In Gleam both values must be **floats** |
338+
| Subtract | `-` | `-` | In Gleam both values must be **ints** |
339+
| Subtract | `-` | `-.` | In Gleam both values must be **floats** |
340+
| Multiply | `*` | `*` | In Gleam both values must be **ints** |
341+
| Multiply | `*` | `*.` | In Gleam both values must be **floats** |
342+
| Divide | `/` | `/` | In Gleam both values **ints** |
343+
| Divide | `/` | `/.` | In Gleam both values must be **floats** |
344+
| Remainder | `%` | `%` | In Gleam both values must be **ints** |
345+
| Concatenate | `+` | `<>` | In Gleam both values must be **strings** |
346+
| Pipe | | `|>` | Gleam's pipe can pipe into anonymous functions |
347+

0 commit comments

Comments
 (0)