3.2 KiB
3.2 KiB
id | title |
---|---|
cheat-sheet | Cheat Sheet |
Primitive | Example |
---|---|
Strings | "Tezos" |
Characters | "t" |
Integers | 42 , 7 |
Natural numbers | 42n , 7n |
Unit | unit |
Boolean |
|
Boolean Logic |
|
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 |
|
Types | type age is int , type name is string |
Includes | #include "library.ligo" |
Functions (short form) |
|
Functions (long form) |
|
If Statement |
|
Options |
|
Assignment | const age: int = 5; |
Assignment on an existing variable ⚠️ This feature is not supported at the top-level scope, you can use it e.g. within functions. Works for Records and Maps as well. |
age := 18; , p.age := 21 |
Type Annotations | ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) |
Variants |
|
Variant (pattern) matching |
|
Records |
|
Maps |
|
Contracts & Accounts |
|
Transactions |
|
Exception/Failure | failwith("Your descriptive error message for the user goes here.") |