Drill 24: Invalid input — Classes, records and object design
Describe what happens when the input is invalid.
What you will be able to do
- Describe what happens when the input is invalid.
Practice task
Describe what happens when the input is invalid.
public record Course(string Slug, string Title, int Lessons);
public class Progress
{
public int Completed { get; private set; }
public void MarkComplete(int total)
{
Completed = Math.Min(total, Completed + 1);
}
}
var html = new Course("html", "HTML Foundations", 8);
var next = html with { Lessons = 9 };Your turn
EasyWrite your answer
Describe what happens when the input is invalid.
TEXT · starter
Your answer…Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.