method with ? : Method Creation « Method « Ruby
- Ruby
- Method
- Method Creation
method with ?
def probably_prime?(x)
x < 8
end
puts probably_prime? 2 # => true
puts probably_prime? 5 # => true
puts probably_prime? 6 # => true
puts probably_prime? 7 # => true
puts probably_prime? 8 # => false
puts probably_prime? 100000 # => false
Related examples in the same category