Check if false then run code
问题 I want to test something. If false do this. I wish not to test for true, only false. My code looks like this and I only need to do something if false: if Model.exists?(table_column: 'joe') # this part is blank else # run this code end My code runs after the else which is what I want. Is there a clean rails/ruby method that tests for false? My code would only run if false, not true. If duplicate, I'll gladly delete. Thanks 回答1: Use unless unless Model.exists?(table_column: 'joe') # run code