Challenge: Defining and Using Enums
Uppgift
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.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 2
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Awesome!
Completion rate improved to 8.33
Challenge: Defining and Using Enums
Svep för att visa menyn
Uppgift
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.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 2
single