Ruby: What is a simple way of searching for certain criteria in an array? -


I have an array that I want to make sure that all numbers are between 1 and 6. This is my array:

  Estimate = [2, 5, 6, 8]   

Or something like this, the user inputs the sequence, I Want a way to check, and if the number is not between 1 and 6, then it does not come out of the loop. And it can also be simple!

  estimate.All? {| I (1..6). Is it included? (I)}    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -