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

Contenu du cours

Introduction to Dart

Introduction to Dart

1. First Acquaintance with Dart
2. Variables and Data Types in Dart
3. Conditional Statements
4. List and String
5. Loops in Dart

book
Data Types in Dart

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

copy
123
void main() { print(22+33); }

In Dart, we can join strings:

dart

main

copy
123
void main() { print("Name " + "Alex"); }

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

dart

main

copy
1234
void main() { // 2 > 1 ? print(true); }

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?

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

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

copy
123
void main() { print("String example " + 44); }
Find the line of code with the error.

Find the line of code with the error.

Sélectionnez la réponse correcte

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 1
We're sorry to hear that something went wrong. What happened?
some-alt