Dart Programming - round Method



This method returns the value of a number rounded to the nearest integer.

Syntax

Number.round()

Return Value

Returns the value of a number rounded to the nearest integer.

Example

void main() { 
   double n1 = 12.023; 
   double n2 = 12.89; 
   
   var value = n1.round(); 
   print( value ); 
   
   value = n2.round(); 
   print( value ); 
} 

It will produce the following output −.

12 
13
dart_programming_numbers.htm
Advertisements