Challenge: Defining and Using Enums
Task
Swipe to start coding
Practice defining and using an enum to represent status values.
- Define an enum named
Statuswith the valuesPending,InProgress, andDone. - Write a function
isDonethat takes aStatusparameter and returnstrueif the status isDone, otherwise returnsfalse. - Call the
isDonefunction with each possible value ofStatusand print the results using this template: "Status: <status_value>, isDone:" Replace <status_value>with the name of the status, and<result>with eithertrueorfalse.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 2
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Awesome!
Completion rate improved to 8.33
Challenge: Defining and Using Enums
Swipe to show menu
Task
Swipe to start coding
Practice defining and using an enum to represent status values.
- Define an enum named
Statuswith the valuesPending,InProgress, andDone. - Write a function
isDonethat takes aStatusparameter and returnstrueif the status isDone, otherwise returnsfalse. - Call the
isDonefunction with each possible value ofStatusand print the results using this template: "Status: <status_value>, isDone:" Replace <status_value>with the name of the status, and<result>with eithertrueorfalse.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 2
single