Last active
May 11, 2023 21:27
-
-
Save MelbourneDeveloper/45452f771b2df8a4a4809fbca7a28568 to your computer and use it in GitHub Desktop.
Day Of Week
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
void main() { | |
var dayOfWeek = 'Monday'; | |
var dayNumber = switch (dayOfWeek) { | |
'Monday' => 1, | |
'Tuesday' => 2, | |
'Wednesday' => 3, | |
'Thursday' => 4, | |
'Friday' => 5, | |
'Saturday' => 6, | |
'Sunday' => 7, | |
_ => 10, //Default value | |
}; | |
print(dayNumber); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment