Mark a high score
An if chooses one path.
LessonRead this before the challenge.
An if lets your code choose. You give it a test in parentheses, and the code in its braces runs only when the test is true:
Integer age = 20;
String ageGroup;
if (age >= 18) {
ageGroup = 'Adult';
} else {
ageGroup = 'Child';
}>= means greater than or equal to. The else part runs when the test is false, so exactly one of the two branches runs.
The trap is the edge. > means strictly greater, so it leaves out the number itself:
if (age > 18) {With this test, an age of exactly 18 lands in the else and becomes Child. When a rule says 18 or more, use >=.
Your task
Support gives each case a priority from its score. A score of 80 or more is High, and every other score is Normal.
In the starter, use if and else to set priority. In the if, test whether score is 80 or more with >=, and set priority to 'High' inside its braces. Set priority to 'Normal' inside the braces of the else. Leave the score line as it is.
For example, a score of 95 gives High because 95 is 80 or more.
Integer score = 80;
String priority;
String companyName = 'RidgePoint Capital';
Boolean reviewed = false;Requirements
- Checks whether score is 80 or more
- Sets priority to
Highinside the if - Sets priority to
Normalin the else - Leaves the score line unchanged