Skip to content

Instantly share code, notes, and snippets.

@mkovalyk
Created October 8, 2020 22:17
Show Gist options
  • Save mkovalyk/e68a5db94c8694b4a2f729b46ec3e4ca to your computer and use it in GitHub Desktop.
Save mkovalyk/e68a5db94c8694b4a2f729b46ec3e4ca to your computer and use it in GitHub Desktop.
Case showing unexpected behavior when return is missing
import 'dart:math';
void main() {
int rand = Random().nextInt(100);
print(isEven(rand));
}
String isEven(int number) {
if (number % 2 == 0) {
return "Yes. It is even";
} else {
"No, it is not even"; // should be an error here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment