diff --git a/gitlab-pages/docs/language-basics/functions.md b/gitlab-pages/docs/language-basics/functions.md index 59baf3b37..e5ac6eb08 100644 --- a/gitlab-pages/docs/language-basics/functions.md +++ b/gitlab-pages/docs/language-basics/functions.md @@ -13,7 +13,7 @@ Each `block` needs to include at least one `instruction`, or a *placeholder* ins -```pascaligo +```pascaligo skip // shorthand syntax block { skip } // verbose syntax @@ -34,7 +34,7 @@ Functions in PascaLIGO are defined using the `function` keyword followed by thei Here's how you define a basic function that accepts two `ints` and returns a single `int`: -```pascaligo +```pascaligo group=a function add(const a: int; const b: int): int is begin const result: int = a + b; @@ -51,7 +51,7 @@ The function body consists of two parts: Functions that can contain all of their logic into a single instruction/expression, can be defined without the surrounding `block`. Instead, you can inline the necessary logic directly, like this: -```pascaligo +```pascaligo group=b function add(const a: int; const b: int): int is a + b ``` @@ -63,7 +63,7 @@ along with a return type. Here's how you define a basic function that accepts two `ints` and returns an `int` as well: -```cameligo +```cameligo group=b let add (a: int) (b: int) : int = a + b ``` @@ -79,7 +79,7 @@ along with a return type. Here's how you define a basic function that accepts two `ints` and returns an `int` as well: -```reasonligo +```reasonligo group=b let add = (a: int, b: int) : int => a + b; ``` @@ -90,7 +90,7 @@ value. -```pascaligo +```pascaligo group=b const increment : (int -> int) = (function (const i : int) : int is i + 1); // a = 2 const a: int = increment(1); @@ -104,19 +104,19 @@ Functions without a name, also known as anonymous functions are useful in cases Here's how to define an anonymous function assigned to a variable `increment`, with it's appropriate function type signature. -```pascaligo +```pascaligo group=c const increment : (int -> int) = (function (const i : int) : int is i + 1); // a = 2 const a: int = increment(1); ``` -```cameligo +```cameligo group=c let increment : (int -> int) = fun (i: int) -> i + 1 ``` -```reasonligo +```reasonligo group=c let increment: (int => int) = (i: int) => i + 1; ```