ApexSensei

Drills Apex basics

Quick win: is it positive?

A comparison like n > 0 is already a Boolean: it is true or false.

Your task

Fill in the body of isPositive so it returns n > 0.

Boolean isPositive(Integer n) {
    return null;
}

Requirements

  1. isPositive(5) should be true
  2. isPositive(0) should be false
  3. isPositive(-2) should be false
  4. isPositive(null) should be false

Sign in to open this drill