3 ms·
Nice. Lack of the ternary operator is the big sticking point I have with really compact Go solutions. OTOH, in real world code I'm glad to see it gone. Also j
by georgemcbay 14y ago
Nice. Lack of the ternary operator is the big sticking point I have with really compact Go solutions.
OTOH, in real world code I'm glad to see it gone.
Also just noticed the () on my import aren't needed, first one would have to be a space anyway but second one can be removed to get the character count down by one and a bit more jiggering of the if/else logic can shave another character:
package main
import o"fmt"
func main(){s:=o.Print
for i:=1;i<101;i++{if f,b:=i%3==0,i%5==0;(f||b){if f{s("Fizz")}
if b{s("Buzz")}}else{s(i)}
s("\n")}}