Intermediate Enumerables • Exercise 1/5

Check All Elements

00:00
0
15 points

Instructions

Create two functions:

  1. all_positive?(numbers) - returns true if ALL numbers are positive
  2. any_negative?(numbers) - returns true if ANY number is negative

Use the all? and any? methods:
ruby
[1, 2, 3].all? { |n| n > 0 } # => true
[1, -2, 3].any? { |n| n < 0 } # => true

Your Code

Results

Click "Run Tests" to see results