ApexSensei

Drills Apex basics

True, false, and null

An empty number in Apex is null, not 0.

Your task

Add a 10-point webinar bonus to a Lead score, then mark the Lead hot when the boosted score is 80 or more and the Lead is still open.

Integer leadScore = null;
Boolean isClosed = false;

// Case A: no score yet, Lead open

// Case B: score 75, Lead open
leadScore = 75;

// Case C: same Lead, now closed
isClosed = true;

Requirements

  1. leadScore should be defaulted with == null ? : or ??
  2. Hot should be a && of the score test and !isClosed
  3. Null boosted: 10 should be printed
  4. Null hot: false should be printed
  5. Open boosted: 85 should be printed
  6. Open hot: true should be printed
  7. Closed hot: false should be printed

Sign in to open this drill