Created
November 11, 2020 13:34
-
-
Save tahlin-notes/f3ed47b57e72630395b0b6f24b41ddbc to your computer and use it in GitHub Desktop.
demo
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
"Nice try." |
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
/// The string concat method with ' ' divider | |
String stringify(int x, int y) { | |
} |
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
String stringify(int x, int y) { | |
return '$x $y'; | |
} |
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() { | |
try { | |
final str = stringify(2, 3); | |
if (str == '2 3') { | |
_result(true); | |
} else if (str == '23') { | |
_result(false, ['Test failed. It looks like you forgot the space!']); | |
} else if (str == null) { | |
_result(false, ['Test failed. Did you forget to return a value?']); | |
} else { | |
_result(false, ['That\'s not quite right. Keep trying!']); | |
} | |
} catch (e) { | |
_result(false, ['Tried calling stringify(2, 3), but received an exception: ${e.runtimeType}']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment