Dart: Numbers

int var_name;      // declares an integer variable 
double var_name;   // declares a double variable 
void main() {
   // declare an integer
   int num1 = 30;             
     
   // declare a double value
   double num2 = 30.50;  

   // print the values
   print(num1);
   print(num2);
}

=> output

30
30.5

# parse()

void main() { 
   print(num.parse('20')); 
   print(num.parse('20.45')); 
}

=> output

20
20.45

Leave a Reply

Your email address will not be published. Required fields are marked *