중고 신입이 개발해보기..

Enumerable - ruby.. 본문

Code Language/Ruby

Enumerable - ruby..

rootkaien 2018. 10. 4. 10:59


find 



numbers = [38, 74, 56, 48, 87, 68, 81, 49]
puts numbers.find {|item| item % 7 == 0 }




scores = { 'Alice' => 50, 'Bob' => 60, 'Carol' => 90, 'David' => 40 }

p scores.find {|k, v| v >= 70 }



detect 




...

'Code Language > Ruby' 카테고리의 다른 글

ruby 기초  (0) 2019.04.09
ruby 설치 - rbenv  (0) 2019.03.26
Ruby Class Hash  (0) 2018.10.02
ruby 구구단.. 루프문 예제  (0) 2018.05.24
The Safe Navigation Operator (&.) in Ruby  (0) 2018.05.11
Comments