use seq instead of empty? inside loop