Skip to content

Instantly share code, notes, and snippets.

@micedreams
Created November 12, 2023 11:04
Show Gist options
  • Save micedreams/0d4af7c699e1e4e14bd53ddedf3249a3 to your computer and use it in GitHub Desktop.
Save micedreams/0d4af7c699e1e4e14bd53ddedf3249a3 to your computer and use it in GitHub Desktop.
Dart fizbuzz
void main() {
for(i=0; i<20;i++){
print(fizz_buzz(i));
}
}
String fizzBuzz() {
if (i % 3 == 0 && i % 5 == 0) {
return "FizzBuzz";
} else if (i % 3 == 0) {
return "Fizz";
} else if (i % 5 == 0) {
return "Buzz";
} else {
return "$i";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment