Accept Only a Few Exact Strings
Write the code, see it run, pass the checks.
The problem
- easy
- Code
A coffee comes in three sizes. Export a type Size that allows only "small", "medium" or "large", and write price(size), which returns 2, 2.5 or 3. Asking for any other size, like "huge", should be a type error.
Your code must pass
- Prices each size
- Has no type errors
- Size is exactly the three sizes
- Rejects another size