If it is a nonzero
op = 2 if op.nonzero? # is it nonzero? puts 12 / op else puts "Can't divide by zero." end