Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 1.71 KB

week1.md

File metadata and controls

38 lines (28 loc) · 1.71 KB

Week 1: Apex Challenges

In week1 we'll start in the shallow end of the Apex pool, with some basic method construction, intake of arguments, and String manipulation. Strings are one of the primitive data types available in Apex.

Once you're ready to check an element of this challenge, just enter the following command into the terminal at your project directory's location (e.g. if you're using a ZS50 Sandbox the terminal will launch in the correct location):

zs50 check sayHello

Remember, you can also "scaffold" a blueprint class into your terminal window to help you get started via the command:

zs50 scaf sayHello

SayHello class

Create a public class SayHello and, inside it...

sayHi

Implement a method sayHi that:

  • Initialize a String type variable to 'Hello, World'
  • write it to the Apex debug logs (hint: see the Apex System.debug())
  • return the string

sayMyName

Implement a method sayMyName that:

  • returns a String set to your name.

speak

Implement a method speak that:

  • takes a single String as an argument
  • checks to make sure the argument is not null
    • if it is, return a String 'Invalid argument`.
    • else:
      • return the String, AFTER converting it to all lowercase (hint: see Apex String class)

Once your class and methods pass all validations you'll see a nice, if anti-climactic, little Success! message.