Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Semrush - keyword research tool

Linux Foundation Training and Certification

Teach Your Child To Read

Disclosure: My content contains affiliate links.

32,308 questions

42,482 answers

573 users

How to cast double to int in Dart

1 Answer

0 votes
void main() {
    double x = 4.5;
 
    int a = x.toInt();
    int b = x.truncate();
    int c = x.round();
    int d = x.ceil();
    int e = x.floor();
    
    print(a); 
    print(b); 
    print(c); 
    print(d); 
    print(e); 
}



  
  
/*
run:
  
4
4
5
5
4
  
*/

 



Learn & Practice Python
with the most comprehensive set of 13 hands-on online Python courses
Start now


answered May 5, 2023 by avibootz

Related questions

1 answer 49 views
49 views asked Oct 7, 2022 by avibootz
1 answer 59 views
2 answers 70 views
2 answers 49 views
49 views asked Oct 19, 2022 by avibootz
1 answer 50 views
50 views asked Oct 7, 2022 by avibootz
...