Improve Rust code
This commit is contained in:
parent
5d6299f71b
commit
82faaa8082
1 changed files with 3 additions and 3 deletions
|
@ -2,9 +2,9 @@ fn main() {
|
|||
let buzzes = [(3, "Fizz"), (5, "Buzz")];
|
||||
|
||||
for i in 1..101 {
|
||||
let output = (0..buzzes.len()).fold(String::new(), |string, j| {
|
||||
if i % buzzes[j].0 == 0 {
|
||||
string + buzzes[j].1
|
||||
let output = buzzes.iter().fold(String::new(), |string, buzz| {
|
||||
if i % buzz.0 == 0 {
|
||||
string + buzz.1
|
||||
} else {
|
||||
string
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue