round

Summary

Rounds a value to the nearest whole number.

Usage

public static double round(double x)

Returns

A whole number value representing the rounded value.

Parameters

x

The value to round.

Description

Rounds a value to the nearest whole number.

Examples

Basic Usage
1
2
3
4
5
import System;
 
Console.log(Math.round(2.2)); // 2
Console.log(Math.round(2.5)); // 3
Console.log(Math.round(2.9)); // 3

Share

HTML | BBCode | Direct Link