Created
October 8, 2020 22:17
-
-
Save mkovalyk/e68a5db94c8694b4a2f729b46ec3e4ca to your computer and use it in GitHub Desktop.
Case showing unexpected behavior when return is missing
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
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