Skip to content

Instantly share code, notes, and snippets.

@tahlin-notes
Created November 11, 2020 13:34
Show Gist options
  • Save tahlin-notes/f3ed47b57e72630395b0b6f24b41ddbc to your computer and use it in GitHub Desktop.
Save tahlin-notes/f3ed47b57e72630395b0b6f24b41ddbc to your computer and use it in GitHub Desktop.
demo
"Nice try."
/// The string concat method with ' ' divider
String stringify(int x, int y) {
}
String stringify(int x, int y) {
return '$x $y';
}
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