April 2017
Intermediate to advanced
628 pages
13h 46m
English
With pattern matching, we saw that patterns are used to test whether a value is of a certain type.
When we find a match we can get to the information specific to that type (or shape). We saw this in the code where we accessed the CourseCodes property, which was specific to the Student type and the TeachesSubjects property, which was specific to the Professor type.
Lastly, you now need to pay careful attention to the order of your case statements, which now matters. The case statement that uses the when clause is more specific than the statement that simply checks for a Student type. This means that the when case needs to happen before ...
Read now
Unlock full access