Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Last active June 12, 2020 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guitarrapc/562146ecd4885c7fa4e199bb90049f93 to your computer and use it in GitHub Desktop.
Save guitarrapc/562146ecd4885c7fa4e199bb90049f93 to your computer and use it in GitHub Desktop.
#42 can't be treat `r as CR on codegolf
1..100|%{"$_`r"+{Fizz}[$_%3]+{Buzz}[$_%5]}
#45
1..100|%{@('Fizz')[$_%3]+@('Buzz')[$_%5]??$_}
#46 can't be treat `r as CR on codegolf
1..100|%{"$_`r"+'Fizz'*!($_%3)+'Buzz'*!($_%5)}
#48 can't be treat `r as CR on codegolf
1..100|%{"$_`r"+@("Fizz")[$_%3]+@("Buzz")[$_%5]}
#50 "" + {Fizz}[0] = Fizz. {ANY} will convert to [string] if left is [string], also can be null.
1..100|%{($t=""+{Fizz}[$_%3]+{Buzz}[$_%5])?$t :$_}
#51 "Fizz"*$true = Fizz
1..100|%{($t='Fizz'*!($_%3)+'Buzz'*!($_%5))?$t :$_}
#53
1..100|%{(($t=""+{Fizz}[$_%3]+{Buzz}[$_%5]),$_)[!$t]}
#53
1..100|%{($_,(""+{Fizz}[$_%3]+{Buzz}[$_%5])|sort)[1]}
#54
1..100|%{$_%15?$_%3?$_%5?$_ :'Buzz':'Fizz':'FizzBuzz'}
#54
1..100|%{$t=$_%3?"":"Fizz";$_%5?$t ?$t :$_ :$t+"Buzz"}
#54
1..100|%{(($t="Fizz"*!($_%3)+"Buzz"*!($_%5)),$_)[!$t]}
#54
1..100|%{($_,('Fizz'*!($_%3)+'Buzz'*!($_%5))|sort)[1]}
#55
1..100|%{$t=$_%3?'':'Fizz';$_%5?$_%3?$_ :$t :$t+'Buzz'}
#55
1..100|%{($p=($_%3?"":"Fizz")+($_%5?"":"Buzz"))?$p :$_}
#58 @('Fizz')[$_%3] = [string] or null.
1..100|%{$($t=@("Fizz")[$_%3]+@("Buzz")[$_%5]);$t ?$t :$_}
#60
1..100|%{$t="$($_%3?'':'Fizz')$($_%5?'':'Buzz')";$t ?$t :$_}
@ataihei
Copy link

ataihei commented Jun 12, 2020

#42
1..100|%{@('Fizz')[$_%3]+{Buzz}[$_%5]??$_}

@guitarrapc
Copy link
Author

it would be shortest at current stage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment