Home>

Please tell me about the conditional branching method in rails if minutes.
Using .between? (A, b), I knew that it was true if it fits in the range, but on the contrary, is there a way to say true if it does not fall within that range?
Currently, the range is narrow, so

a [1]! = 1&&a [1]! = 2&&a [1]! = 3&&…


It is not smart.

  • Answer # 1

    On the contrary, is there a way to say true if it does not fall within that range?

    Simply,.between?Conditions by!!Isn't it useless to reverse with?

    ! (a [1] .between? (1, 3))