3 ms·
More in the tradition of code golf, my reasonably-terse gawk fizzbuzz, abusing conditional expressions: #!/usr/bin/env gawk -f BEGIN { for (i=1;i<
by dredmorbius 3y ago
More in the tradition of code golf, my reasonably-terse gawk fizzbuzz, abusing conditional expressions:
#!/usr/bin/env gawk -f
BEGIN {
for (i=1;i<=100;i++) {
printf(" %2s", i%(3*5)!=0 ? i%5!=0 ? i%3!=0 ? i : "fizz" : "buzz" : "fizzbuzz\n" )
}
printf("\n")
}
No idea as to actual throughput though. I believe this is slower than explicit loop, if/then, or switch/case testing though (based on hazy recollections of past performance testing).