Make a Parameter Optional
Write the code, see it run, pass the checks.
The problem
- easy
- Code
Write greet(name, greeting), which returns the greeting, a space and the name, like "Hi Ada". The greeting is optional: when it's left out, use "Hello". Both are strings, so greet() with no name, or with a number, is a type error.
Your code must pass
- Uses the greeting it's given
- Says Hello without one
- Has no type errors
- The greeting can be left out
- Rejects a call without a name
- Rejects a number as the greeting