Skip to content

Instantly share code, notes, and snippets.

@amani27
Created December 20, 2022 12:18
Show Gist options
  • Select an option

  • Save amani27/45bdfc3a2b4aa2fcec96a503f3b4f8bc to your computer and use it in GitHub Desktop.

Select an option

Save amani27/45bdfc3a2b4aa2fcec96a503f3b4f8bc to your computer and use it in GitHub Desktop.
Demonstrating Dart control-flow statements
void main() {
int year = 1999;
List<String> planets = ['Jupiter', 'Saturn', 'Uranus', 'Neptune'];
if (year >= 2001) {
print('21st century');
} else if (year >= 1901) {
print('20th century');
}
for (final object in planets) {
print(object);
}
for (int month = 1; month <= 12; month++) {
print(month);
}
while (year < 2016) {
year += 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment