2015-02-10から1日間の記事一覧

Rubyで配列に対するinclude?(x)の論理積をどう書くか

先日のどう書くで次のようなコードを書き、疑問に感じました。ダサすぎる……。 if wall.include?(e) && wall.include?(w) && wall.include?(n) return s, "S" elsif wall.include?(n) && wall.include?(e) && wall.include?(s) return w, "W" elsif wall.incl…