Created
May 11, 2023 22:30
-
-
Save MelbourneDeveloper/1528d67474e7e37f1a90bc08de8ce12d to your computer and use it in GitHub Desktop.
Multiple Values and when
This file contains hidden or 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 a, int b) returnMulti() => (1, 2); | |
void main() { | |
var numbers = returnMulti(); | |
var dayNumber = switch (numbers) { | |
(int a, int b) when a == 1 && b == 2 => 'One and Two', | |
(_, _) => 'Default' | |
}; | |
print(dayNumber); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment