diff --git a/gitlab-pages/docs/api/cheat-sheet.md b/gitlab-pages/docs/api/cheat-sheet.md index 412ba5bd5..637d511b5 100644 --- a/gitlab-pages/docs/api/cheat-sheet.md +++ b/gitlab-pages/docs/api/cheat-sheet.md @@ -11,22 +11,153 @@ import Syntax from '@theme/Syntax'; Note that this table is not compiled before production and currently needs to be managed manually. --> +
+
Primitive
+
Example
+
Strings
+
+ +```pascaligo +const name: string = "Tezos"; +``` + +
+
+Characters +
+
+ +```pascaligo +const t: string = "t"; +``` + +
+
+Integers +
+
+ +```pascaligo +const i: int = 42; +``` + +
+
+Natural numbers +
+
+ +```pascaligo +const n: int = 7n; +``` + +
+
+Unit +
+
+ +```pascaligo +const u: unit = unit; +``` + +
+
+Boolean +
+
+ +```pascaligo +const hasDriversLicense: bool = False; +const adult: bool = True; +``` + +
+
+Boolean Logic +
+
+ +```pascaligo +const booleanLogic: bool = (not True) == False == (False and True) == (False or False); +``` + +
+
+Mutez (micro tez) +
+
+ +```pascaligo +const tez: mutez = 42mutez; +``` + +
+
+Address +
+
+ +```pascaligo +const tz1address: address = ""tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx"; +const kt1address: address = ""KT1JepfBfMSqkQyf9B1ndvURghGsSB8YCLMD"; +``` + +
+
+Addition +
+
+ +```pascaligo +const add_int: int = 3 + 4; +const add_nat: nat = 3n + 4n; +``` + +
+
+Multiplication & Division +
+
+ +```pascaligo +const mul_int: int = 3 + 4; +const mul_nat: nat = 3n + 4n; + +const div_int: int = 10 / 5; +const div_nat: nat = 10n / 5n; +``` + +
+
+Modulo +
+
+ +```pascaligo +const mod: int = 10 mod 3; +``` + +
+
+Tuples +
+
+ +```pascaligo +const mod: int = 10 mod 3; +``` + +
+
+ + + |Primitive |Example| |--- |---| -|Strings | `"Tezos"`| -|Characters | `"t"`| -|Integers | `42`, `7`| -|Natural numbers | `42n`, `7n`| -|Unit| `unit`| -|Boolean|
const hasDriversLicense: bool = False;
const adult: bool = True;
| -|Boolean Logic|
(not True) == False == (False and True) == (False or False)
| -|Mutez (micro tez)| `42mutez`, `7mutez` | -|Address | `"tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx"`, `"KT1JepfBfMSqkQyf9B1ndvURghGsSB8YCLMD"`| -|Addition |`3 + 4`, `3n + 4n`| -|Multiplication & Division| `3 * 4`, `3n * 4n`, `10 / 5`, `10n / 5n`| |Modulo| `10 mod 3`| |Tuples|
type name is (string * string);
const winner: name = ("John", "Doe");
const firstName: string = winner.0;
const lastName: string = winner.1;
| |Types|`type age is int`, `type name is string` |