Ruby - Methods - Introduction

  • + 0 comments
    def prime?(num)
        ((2..num).select {|x| num % x == 0 }).size == 1 ? true : false
    end