Ruby Technician Certification Exam

A record of what you learned while studying for the Ruby Engineer Certification Exam.

zip Methods provided by the Enumerable module. The Array class includes the Enumerable module.

a = [1,2,3]
b = [4,5,6]
a.zip(b) #=>[[1, 4], [2, 5], [3, 6]]

[1,2,3].zip([4,5,6])
#=>=> [[1, 4], [2, 5], [3, 6]]

Range operator (../...)

(5..10).to_a   #=>[5,6,7,8,9,10]
(5...10).to_a  #=>[5,6,7,8,9]

select/find_all Methods provided by the Enumerable module. The Array class includes the Enumerable module. Execute a block for each element, find the element for which the result is true (find / select), and return it as an array.

numbers = [1,2,3,4,5]
numbers.select{|n|.even?}   #=> [2, 4]
numbers.find_all{|n|.even?} #=> [2, 4]

Recommended Posts

Ruby Technician Certification Exam
Passed the Ruby Technician Certification Exam Silver
Ruby Technician Certification Exam Silver Examination Note
[For Ruby beginners] Ruby engineer certification exam Silver/Gold exam notes
Passed the Ruby engineer certification exam Silver in two weeks from inexperienced
Looking back on the important things to pass the Ruby engineer certification exam Silver