Count open cases
Write Apex · Beginner · 5 min · Runs in the browser, no org needed · Free
Scenario. A short script should remember that four cases are open. Store that count as a number.
Store how many cases are open as a whole number, not as text.
What you will learn
An Integer is a whole number. Write the digits with no quotes. Text stays in single quotes, so '4' is text and 4 is a number.
Integer openCases = 4;
Gotcha. Quotes turn a number into text. Later math needs the bare number.
The task
Set the open-case count to 4, as a number.
Examples:
Integer openCases = 4;→ openCases holds the number 4Integer openCases = '4';→ that is text, not a number
Requirements:
- Set
openCasesto the number4. - Keep the
Integertype and the variable name. - Do not put quotes around
4. - Leave
companyNameas the quoted company name.
Starter code
String companyName = 'RidgePoint Capital';
Integer openCases = null;
String city = 'Denver';
Boolean active = true;
When it passes
`openCases` is the Integer 4, with no quotes, and the company name stays text.
You write the Apex yourself. ApexSensei runs it and tells you what passed and what did not.