Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は文字列s1、s2、s3、s4を持っていて、すべてを比較したいので、s1をs2、s3、s4と、s2をs3、s4と、s3をs4と比較したいのですが、それを行う最良の方法は何ですか.
forループみたいなもの?
ありがとう
RubyArray#combinationメソッドを参照してください:
Array#combination
arr = [1, 2, 3, 4] arr.combination(2) do |x,y| # Compare X to Y end