Challenge: Defining and Using Enums
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 3. Capitolo 2
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
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
Scorri per mostrare il menu
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 3. Capitolo 2
single