diff --git a/gitlab-pages/docs/api/cheat-sheet.md b/gitlab-pages/docs/api/cheat-sheet.md index 15e10bfe4..9e7020177 100644 --- a/gitlab-pages/docs/api/cheat-sheet.md +++ b/gitlab-pages/docs/api/cheat-sheet.md @@ -30,7 +30,7 @@ Note that this table is not compiled before production and currently needs to be |Includes|```#include "library.ligo"```| |Functions (short form)|
function add (const a : int ; const b : int) : int is
block { skip } with a + b
|
|Functions (long form)|function add (const a : int ; const b : int) : int is
block {
const result: int = a + b;
} with result
|
-| If Statement | if age < 16
then fail("Too young to drive.");
else const new_id: int = prev_id + 1;
|
+| If Statement | if age < 16
then failwith ("Too young to drive.");
else const new_id: int = prev_id + 1;
|
|Options|type middleName is option(string);
const middleName : middleName = Some("Foo");
const middleName : middleName = None;
|
|Assignment| ```const age: int = 5;```|
|Assignment on an existing variable type prices is map(nat, tez);
const prices : prices = map
10n -> 60mutez;
50n -> 30mutez;
100n -> 10mutez;
end
const price: option(tez) = prices[50n];
prices[200n] := 5mutez;
|
|Contracts & Accounts|const destinationAddress : address = "tz1...";
const contract : contract(unit) = get_contract(destinationAddress);
|
|Transactions|const payment : operation = transaction(unit, amount, receiver);
|
-|Exception/Failure|`failwith("Your descriptive error message for the user goes here.")`|
+|Exception/Failure|`failwith ("Your descriptive error message for the user goes here.")`|
@@ -63,7 +63,7 @@ Note that this table is not compiled before production and currently needs to be
|Types|`type age = int`, `type name = string` |
|Includes|```#include "library.mligo"```|
|Functions |let add (a : int) (b : int) : int = a + b
|
-| If Statement | let new_id: int = if age < 16
then failwith("Too young to drive.")
else prev_id + 1
|
+| If Statement | let new_id: int = if age < 16
then failwith ("Too young to drive.")
else prev_id + 1
|
|Options|type middle_name = string option
let middle_name : middle_name = Some "Foo"
let middle_name : middle_name = None
|
|Variable Binding | ```let age: int = 5```|
|Type Annotations| ```("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)```|
@@ -73,7 +73,7 @@ Note that this table is not compiled before production and currently needs to be
|Maps|type prices = (nat, tez) map
let prices : prices = Map.literal [
(10n, 60mutez);
(50n, 30mutez);
(100n, 10mutez)
]
let price: tez option = Map.find_opt 50n prices
let prices: prices = Map.update 200n (Some 5mutez) prices
|
|Contracts & Accounts|let destination_address : address = "tz1..."
let contract : unit contract =
Tezos.get_contract destination_address
|
|Transactions|let payment : operation =
Tezos.transaction unit amount receiver
|
-|Exception/Failure|`failwith("Your descriptive error message for the user goes here.")`|
+|Exception/Failure|`failwith ("Your descriptive error message for the user goes here.")`|
@@ -95,7 +95,7 @@ Note that this table is not compiled before production and currently needs to be
|Types|`type age = int;`, `type name = string;` |
|Includes|```#include "library.mligo"```|
|Functions |let add = (a: int, b: int) : int => a + b;
|
-| If Statement | let new_id: int = if (age < 16) {
failwith("Too young to drive.");
} else { prev_id + 1; }
|
+| If Statement | let new_id: int = if (age < 16) {
failwith ("Too young to drive.");
} else { prev_id + 1; }
|
|Options|type middle_name = option(string);
let middle_name : middle_name = Some("Foo");
let middle_name : middle_name = None;
|
|Variable Binding | ```let age: int = 5;```|
|Type Annotations| ```("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)```|
@@ -105,7 +105,7 @@ Note that this table is not compiled before production and currently needs to be
|Maps|type prices = map(nat, tez);
let prices : prices = Map.literal([
(10n, 60mutez),
(50n, 30mutez),
(100n, 10mutez)
]);
let price: option(tez) = Map.find_opt(50n, prices);
let prices: prices = Map.update(200n, Some (5mutez), prices);
|
|Contracts & Accounts|let destination_address : address = "tz1...";
let contract : contract(unit) =
Tezos.get_contract(destination_address);
|
|Transactions|let payment : operation =
Tezos.transaction (unit, amount, receiver);
|
-|Exception/Failure|`failwith("Your descriptive error message for the user goes here.");`|
+|Exception/Failure|`failwith ("Your descriptive error message for the user goes here.");`|