Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Print Function in Dart | First Acquaintance with Dart
Introduction to Dart

bookPrint Function in Dart

To display information in the console, add text inside the parentheses of the print() function.

main.dart

main.dart

copy
123
void main() { print("Text you want to output"); }

If you want to output the text to the console, we must write it inside the quotation marks.

main.dart

main.dart

copy
123456
void main() { // The text can be written in single quotation marks print('Hi, Codefinity!'); // The text also can be written in double quotation marks print("I want know more"); }

The main rule when using the print() function is that it's important for the quotation marks surrounding the text to match on both sides. For example, if we use single quotes to print text ('like this'), we must close them with single quotes as well. This allows Dart to correctly recognize it as text to be printed, rather than a variable name or instruction. If the quotation marks do not match, or if they are absent altogether, it can lead to a runtime error in the program.

main.dart

main.dart

copy
123
void main() { print(2); }

Working with numbers differs from working with text. When displaying numbers, you don’t need to use quotes (" " or ' '), because numbers are treated as numeric values, not text.

question mark

Which statement correctly uses print() to display text or a number in Dart?

Select the correct answer

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 3

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Awesome!

Completion rate improved to 4.55

bookPrint Function in Dart

Свайпніть щоб показати меню

To display information in the console, add text inside the parentheses of the print() function.

main.dart

main.dart

copy
123
void main() { print("Text you want to output"); }

If you want to output the text to the console, we must write it inside the quotation marks.

main.dart

main.dart

copy
123456
void main() { // The text can be written in single quotation marks print('Hi, Codefinity!'); // The text also can be written in double quotation marks print("I want know more"); }

The main rule when using the print() function is that it's important for the quotation marks surrounding the text to match on both sides. For example, if we use single quotes to print text ('like this'), we must close them with single quotes as well. This allows Dart to correctly recognize it as text to be printed, rather than a variable name or instruction. If the quotation marks do not match, or if they are absent altogether, it can lead to a runtime error in the program.

main.dart

main.dart

copy
123
void main() { print(2); }

Working with numbers differs from working with text. When displaying numbers, you don’t need to use quotes (" " or ' '), because numbers are treated as numeric values, not text.

question mark

Which statement correctly uses print() to display text or a number in Dart?

Select the correct answer

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

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