FizzBuzz: Difference between revisions

408 bytes added ,  10 months ago
m (→‎{{header|Sidef}}: shorter one-liner)
Line 10,489:
print(s ?? i)
}</syntaxhighlight>
 
=== using a precomputed cycle ===
<syntaxhighlight lang="swift">
import Foundation
 
let formats: [String] = [
"%d",
"%d",
"fizz",
"%d",
"buzz",
"fizz",
"%d",
"%d",
"fizz",
"buzz",
"%d",
"fizz",
"%d",
"%d",
"fizzbuzz",
]
 
var count = 0
var index = 0
while count < 100 {
count += 1
print(String(format: formats[index], count))
index += 1
index %= 15
}
</syntaxhighlight>
 
=={{header|Symsyn}}==