Created
December 20, 2022 12:18
-
-
Save amani27/45bdfc3a2b4aa2fcec96a503f3b4f8bc to your computer and use it in GitHub Desktop.
Demonstrating Dart control-flow statements
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
| 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