What does this print?
String tag(int n) {
return switch (n % 2) {
0 => 'even',
_ => 'odd',
};
}
void main() {
print(tag(4));
}
Try it in the online Dart Playground →
[spoiler title="Solution"]
Answer:
even
Explanation:
switch expressions return a value directly from matching case.
[/spoiler]