Store the company name
Write Apex · Beginner · 5 min · Runs in the browser, no org needed · Free
Scenario. A setup script still has an empty company name. Store the real name before anything else reads it.
Save a company name in a String, with single quotes and a semicolon.
What you will learn
A String holds text. Write the text in single quotes and end the statement with a semicolon.
String city = 'Denver';
Gotcha. null means no text yet. A name in quotes is a value the rest of the script can use.
The task
Give the company a name by replacing the empty companyName value.
Examples:
String city = 'Denver';→ city holds the text DenverString companyName = null;→ companyName holds no text yet
Requirements:
- Set
companyNametoRidgePoint Capital. - Keep the
Stringtype and the variable name. - Use single quotes around the name and end the line with a semicolon.
- Leave the other variables as they are.
Starter code
String companyName = null;
String city = 'Denver';
String industry = 'Finance';
Boolean active = true;
When it passes
`companyName` is the String `RidgePoint Capital`, in single quotes, and it is no longer null.
You write the Apex yourself. ApexSensei runs it and tells you what passed and what did not.