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.

Revisions

  1. amani27 created this gist Dec 20, 2022.
    22 changes: 22 additions & 0 deletions control_flow_sample.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    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;
    }
    }