Last active
November 29, 2020 03:14
-
-
Save karabanovbs/d00f5020b17eaf174c943e1a777254c4 to your computer and use it in GitHub Desktop.
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.5 Функции | |
// Модернизируйте предыдущие функции так, чтобы на вход они принимали необходимые данные для работы. Параметр должен быть опциональным. | |
void main() { | |
String reverseText([String text]) { | |
return text?.split(' ')?.reversed?.join(' '); | |
} | |
double average([List<num> arrayList]) { | |
if (arrayList == null) return null; | |
return arrayList.reduce((accumulator, current) => accumulator + current) / | |
arrayList.length; | |
} | |
print(reverseText()); | |
print(average()); | |
print(reverseText('test1 test2')); | |
print(average([1,2,3,4,5])); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment