From 8d5a0990094694703d918ac5ffa1171798075763 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Wed, 26 Feb 2020 19:37:05 +0100 Subject: [PATCH] Fixed "fail" -> "failwith" in the cheat-sheet. --- gitlab-pages/docs/api/cheat-sheet.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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

*⚠️ 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``` | @@ -41,7 +41,7 @@ Note that this table is not compiled before production and currently needs to be |Maps|
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.");`|