This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
// Вывести на экран количество уникальных слов в тексте. | |
const text = ''' | |
She sells sea shells on the sea shore | |
The shells that she sells are sea shells I'm sure | |
So if she sells sea shells on the sea shore | |
I'm sure that the shells are sea shore shells | |
'''; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
// Задание 4 | |
// Создать Map телефонных номеров с именем numberBook и типом данных (“имя”: “номер телефона”), заполнить данными: Иван: 2264865, Татьяна: 89523366684, Олег: 84952256575. | |
// Вывести на экран весь телефонный справочник numberBook. | |
// Вставить новый номер в карту: Екатерина: 2359942 | |
var numberBook = <String, int>{ | |
'Иван': 2264865, | |
'Татьяна': 89523366684, | |
'Олег': 84952256575, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
// Создать список var list = [1,2,3,4,5,6,7,8]; | |
var list = [1, 2, 3, 4, 5, 6, 7, 8]; | |
// Вывести длину этого списка; | |
print('Элементов в списке: ${list.length}'); | |
// Вывести отсортированный список list в порядке убывания, используя sort; | |
list.sort((a, b) => b.compareTo(a)); | |
print(list); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 2 | |
// Используете 32-битный символ Unicode u2665 выведите сообщение в консоль: I ♥ dart | |
void main() { | |
print('I \u2665 dart'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 1 | |
// Создайте целочисленную переменную с именем a проверить является ли число четным. | |
void main() { | |
const a = 7; | |
if (a.isEven) { | |
print('Число $a чётное'); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
При инициализации простой переменной (числа, строки) значением тип можно не указывать, так как dart сам определит её тип. | |
Тип необходимо указывать если мы объявляем пустую переменную или работаем с коллекцией. | |
*/ | |
var a = 1; //глобальная перменная типа int | |
void main() { | |
var b = 2.0; //локальная перменная типа double | |
var text = 'Dart'; //локальная перменная типа String |
NewerOlder