Table of contents
Getting Started
Installation
Usage
FAQ
Testing
What's new
Migration Guide
Basic Syntax
Data Types
Expressions
Variables
Conditions
Commands
Arrays
Loops
Functions
Importing
Advanced Syntax
As Cast
Builtins
Type Condition
Compiler Flags
Standard Library
Array
Date
Environment
FileSystem
HTTP
Math
Test
Text
Contributing
How to
Guide
Compiler structure
Amber by Example
Backup Rotator
ShellCheck tester
Ubuntu Updater
Bot Detector
LSP Installer
Press
Math
math_abs
pub fun math_abs(number)
Returns the absolute value of a number
Usage
import { math_abs } from "std/math"
let absolute = math_abs(-42)
echo(absolute) // 42
math_ceil
pub fun math_ceil(number: Num): Int
Returns the smallest integer greater than or equal to a number
Usage
import { math_ceil } from "std/math"
let ceiled = math_ceil(3.1)
echo(ceiled) // 4
math_floor
pub fun math_floor(number: Num): Int
Returns the largest integer less than or equal to a number
Usage
import { math_floor } from "std/math"
let floored = math_floor(3.9)
echo(floored) // 3
math_round
pub fun math_round(number: Num): Int
Returns a number, rounded to the nearest integer
Usage
import { math_round } from "std/math"
let rounded = math_round(3.7)
echo(rounded) // 4
math_sum
pub fun math_sum(list)
Sums an array's contents
Usage
import { math_sum } from "std/math"
let total = math_sum([1, 2, 3, 4, 5])
echo(total) // 15
Table of contents
Getting Started
Installation
Usage
FAQ
Testing
What's new
Migration Guide
Basic Syntax
Data Types
Expressions
Variables
Conditions
Commands
Arrays
Loops
Functions
Importing
Advanced Syntax
As Cast
Builtins
Type Condition
Compiler Flags
Standard Library
Array
Date
Environment
FileSystem
HTTP
Math
Test
Text
Contributing
How to
Guide
Compiler structure
Amber by Example
Backup Rotator
ShellCheck tester
Ubuntu Updater
Bot Detector
LSP Installer
Press