diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -73,6 +73,9 @@ let result = if (x < y) { } else { subtract(x, y) }; // result = 15 + + +puts(result); // prints the value of result to the console ``` ## Types @@ -137,13 +140,14 @@ fn add(x, y) { Mana has a number of built-in functions that are available to the programmer. These functions are built into the language and can be used without having to define them. The following is a list of built-in functions that are available in Mana: -| Function | Description | Parameters | Example | Output | -| -------- | --------------------------------------------- | --------------------- | ---------------------- | -------------- | -| `len` | Returns the length of a string or an array | `string` | `len("Hello, World!")` | `13` | -| `push` | Appends an element to the end of an array | `array`, `expression` | `push([1, 2, 3], 4)` | `[1, 2, 3, 4]` | -| `first` | Returns the first element of an array | `array` | `first([1, 2, 3])` | `1` | -| `last` | Returns the last element of an array | `array` | `last([1, 2, 3])` | `3` | -| `rest` | Returns all but the first element of an array | `array` | `rest([1, 2, 3])` | `[2, 3]` | +| Function | Description | Parameters | Example | Output | +| -------- | --------------------------------------------- | --------------------- | ----------------------- | --------------- | +| `len` | Returns the length of a string or an array | `string` | `len("Hello, World!")` | `13` | +| `push` | Appends an element to the end of an array | `array`, `expression` | `push([1, 2, 3], 4)` | `[1, 2, 3, 4]` | +| `first` | Returns the first element of an array | `array` | `first([1, 2, 3])` | `1` | +| `last` | Returns the last element of an array | `array` | `last([1, 2, 3])` | `3` | +| `rest` | Returns all but the first element of an array | `array` | `rest([1, 2, 3])` | `[2, 3]` | +| `puts` | Prints a value to the console | `expression` | `puts("Hello, World!")` | `Hello, World!` | ## Strings |
