Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Data Types | Variables and Data Types
Introduction to Dart

Data TypesData Types

What are Data Types?

Dart supports different data types for different tasks. Like in life, we use words to communicate and numbers to calculate.

  • Dart allows us to use numbers for mathematical operations:
dart

main.dart

  • In Dart, we can join strings:
dart

main.dart

  • We can use the bool data type to print whether a statement is true or false:
dart

main.dart

In the future, we will learn to work with all types of data, and in the following chapters we will consider the simplest of them.

What are the Differences Between Data Types?

Image

For example, we can perform mathematical operations between int and double because both are numbers.

Note

int and double are numbers, but the int data type does not store decimals, so it can only store integers. But the double can store any number.

However, we cannot add a String to an int or double because a String is simply a sequence of characters, which does not support mathematical operations.

dart

main.dart

Find the line of code with the error.

Виберіть правильну відповідь

Все було зрозуміло?

Секція 2. Розділ 1
course content

Зміст курсу

Introduction to Dart

Data TypesData Types

What are Data Types?

Dart supports different data types for different tasks. Like in life, we use words to communicate and numbers to calculate.

  • Dart allows us to use numbers for mathematical operations:
dart

main.dart

  • In Dart, we can join strings:
dart

main.dart

  • We can use the bool data type to print whether a statement is true or false:
dart

main.dart

In the future, we will learn to work with all types of data, and in the following chapters we will consider the simplest of them.

What are the Differences Between Data Types?

Image

For example, we can perform mathematical operations between int and double because both are numbers.

Note

int and double are numbers, but the int data type does not store decimals, so it can only store integers. But the double can store any number.

However, we cannot add a String to an int or double because a String is simply a sequence of characters, which does not support mathematical operations.

dart

main.dart

Find the line of code with the error.

Виберіть правильну відповідь

Все було зрозуміло?

Секція 2. Розділ 1
some-alt