Решение на Пета задача от Яни Малцев

Обратно към всички решения

Към профила на Яни Малцев

Резултати

  • 2 точки от тестове
  • 0 бонус точки
  • 2 точки общо
  • 0 успешни тест(а)
  • 0 неуспешни тест(а)

Код

REPOSITORY = 'https://github.com/y-maltsev/ruby-retrospective-4'
#1 Can use .empty? instead of @smth.size == 0 to check if container is
#empty.
#2 Learned how to create new block out of 2 or more others(by calling
#them in single block).
#3 Monkey patch(and change functionality) of "base" class good idea
#for small projects(homework size), but bad for anything bigger. But
#its best to be always avoided.
#4 Defining each can be done simply with .each(&block)
#5 can use ready functions to check a number's type(real? integer?
#etc.) instead of reading their class
#6 In Case-When for multiple possibilities it must be divided with "," instead of ||, otherwise it doesnt work.
#7 Impropper use of @ in local variable might cause the program to
#misbehave(6 errors for otherwise working code)
#8 can use "(int_number).times" as a "for loop".
#9 For functions with the same funcionality but different initial #values - can be used with generator with arguments passing the #initial values

История (1 версия и 1 коментар)

Яни обнови решението на 16.01.2015 14:55 (преди около 9 години)

+REPOSITORY = 'https://github.com/y-maltsev/ruby-retrospective-4'
+
+#1 Can use .empty? instead of @smth.size == 0 to check if container is
+#empty.
+
+#2 Learned how to create new block out of 2 or more others(by calling
+#them in single block).
+
+#3 Monkey patch(and change functionality) of "base" class good idea
+#for small projects(homework size), but bad for anything bigger. But
+#its best to be always avoided.
+
+#4 Defining each can be done simply with .each(&block)
+
+#5 can use ready functions to check a number's type(real? integer?
+#etc.) instead of reading their class
+
+#6 In Case-When for multiple possibilities it must be divided with "," instead of ||, otherwise it doesnt work.
+
+#7 Impropper use of @ in local variable might cause the program to
+#misbehave(6 errors for otherwise working code)
+
+#8 can use "(int_number).times" as a "for loop".
+
+#9 For functions with the same funcionality but different initial #values - can be used with generator with arguments passing the #initial values