Skip to content
drewmccluskey edited this page Jan 8, 2019 · 4 revisions

round

This function will round an inputted number.

Syntax:

round(val)
Argument Description
double val The number to round

Returns: int

Description:

This function will round the input number variable. This function is useful when you have a decimal number but you want a whole number such as 5.82 to 6. Uses are common when displaying numbers on the screen and wanting to keep from long trails of decimals.

Example:

double numberToRound = 20.45;
var wholeNumber = round(numberToRound); //return 20

This code will round the number 20.45 to 20.

Back to number_functions

Clone this wiki locally