You are viewing a single comment's thread. Return to all comments →
def prime?(num) return false if num <= 1 (2..Math.sqrt(num).to_i).none? { |n| num % n == 0 } end
Seems like cookies are disabled on this browser, please enable them to open this website
Ruby - Methods - Introduction
You are viewing a single comment's thread. Return to all comments →