Enums and fixed choices

Can a caller assign the unrelated string shipped directly to an enum variable?

Examples

Worked example

Input
Order states are NEW, PAID, and SENT.
Expected output
No.

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

The variable expects a declared enum value rather than an arbitrary string.

Back to the lesson