Traffic Light (Enums)

Define an enum for RED, YELLOW, GREEN. Read a colour and print the action: stop, slow or go.

Input: One of RED, YELLOW, GREEN.

Output: The action.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Convert the text to your enum, then match or switch on it.

More Enums practice