Skip to content

Instantly share code, notes, and snippets.

@kwalrath
Last active August 29, 2015 14:26
Show Gist options
  • Save kwalrath/dab00eb68704900f70ba to your computer and use it in GitHub Desktop.
Save kwalrath/dab00eb68704900f70ba to your computer and use it in GitHub Desktop.
assert
main() {
var text = 'Hi';
var number = 99;
var urlString = 'https://github.com/';
// Make sure the variable has a non-null value.
assert(text != null);
// Make sure the value is less than 100.
assert(number < 100);
// Make sure this is an https URL.
assert(urlString.startsWith('https'));
print('About to call assert(false).');
assert(false);
print('Oops, you weren\'t running in checked mode.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment