FizzBuzz in gawk, using only printf() and C conditional expressions:
#!/bin/gawk -fBEGIN { for (i=1;i<=100;i++) { printf(" %2s", i%(3*5)!=0 ? i%3!=0 ? i%5!=0 ? i : "buzz" : "fizz" : "fizzbuzz\n" ) } printf("\n")}
The more traditional approach is with if/then statements.
I need to check again, but I think if/then actually turns out to run faster. I like the compact form of the example above though.
#gawk #awk #FizzBuzz
Edit: tyop.
Mastodon is the best way to keep up with what's happening.
Follow anyone across the fediverse and see it all in chronological order. No algorithms, ads, or clickbait in sight.