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.
すべての数値が 1 から 6 の間にあることを確認したい配列があります。これが私の配列です。
guess = [2, 5, 6, 8]
またはそのようなもの。ユーザーがシーケンスを入力します。とにかく、それをチェックする方法が欲しいのですが、数値がすべて 1 から 6 の間にない場合、ループから抜け出すことはありません。また、それは簡単にしてください!
guess.all?{|i| (1..6).include?(i)}