Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

dart
basics

What is a double in Dart?

Educative Answers Team

In the Dart programming language, double is a data type that stores decimal numbers (fractional numbers). For each double variable, eight bytes are allocated in the memory.

If you try to assign any integer value to the double variable then, by default, it will be cast to the double data type. For example, 66 would be represented as 6.06.0.

svg viewer

Code

import 'dart:convert';
void main() {
    //Fractional value
    double num1 = 6.532;
    // Integer Value
    double num2 = 6;// cast this integer to double
    // printing both numbers
    print(num1);
    print(num2);
}

RELATED TAGS

dart
basics
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring