Created
June 29, 2020 19:22
-
-
Save cbrevik/983fdbdb962c415302e13a3a472ffd3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int birthYear = (ruleNumber, year) switch | |
{ | |
// Rule 1. 500–749: 1854–1899 | |
(>= 500 and <= 749, >= 54) => 1800 + year, | |
// Rule 2. 000–499: 1900–1999 | |
(< 500, _) => 1900 + year, | |
// Rule 3. 900–999: 1940–1999 | |
(>= 900, >= 40) => 1900 + year, | |
// Rule 4. 500–999: 2000–2039 | |
(>= 500, <= 39) => 2000 + year, | |
// No rule | |
(_, _) => 0 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment