Last active
December 2, 2018 12:27
-
-
Save alexandersazonof/598de14a3a55b6de21f49c65989ac6a2 to your computer and use it in GitHub Desktop.
This file contains 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
#Дана строка в которой записаны слова через пробел. Необходимо посчитать количество слов. | |
str = "one two three four five" | |
puts str.split.size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Обычно принято делать цепочку вызовов на одной строчке, если промежуточные переменные не используются больше нигде
array = str.split " "
puts array.size