# 1, 2, Fizz, 4, Buzz

## Introduction

In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other catalogue challenges, there is "Hello World!" and "Is this number a prime?".

## Challenge

Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

## Output

The output will be a list of numbers (and Fizzes, Buzzes and FizzBuzzes) separated by a newline (either \n or \r\n). A trailing newline is acceptable, but a leading newline is not. Apart from your choice of newline, the output should look exactly like this:

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
Fizz
22
23
Fizz
Buzz
26
Fizz
28
29
FizzBuzz
31
32
Fizz
34
Buzz
Fizz
37
38
Fizz
Buzz
41
Fizz
43
44
FizzBuzz
46
47
Fizz
49
Buzz
Fizz
52
53
Fizz
Buzz
56
Fizz
58
59
FizzBuzz
61
62
Fizz
64
Buzz
Fizz
67
68
Fizz
Buzz
71
Fizz
73
74
FizzBuzz
76
77
Fizz
79
Buzz
Fizz
82
83
Fizz
Buzz
86
Fizz
88
89
FizzBuzz
91
92
Fizz
94
Buzz
Fizz
97
98
Fizz
Buzz


The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation.

## Further Rules

• This is not about finding the language with the shortest approach for playing FizzBuzz, this is about finding the shortest approach in every language. Therefore, no answer will be marked as accepted.

• Submissions are scored in bytes in an appropriate preexisting encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score--if in doubt, please ask on Meta.

• Nothing can be printed to STDERR.

• Feel free to use a language (or language version) even if it's newer than this challenge. If anyone wants to abuse this by creating a language where the empty program generates FizzBuzz output, then congrats for paving the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

• If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck derivatives like Alphuck and ???), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

• Because the output is fixed, you may hardcode the output (but this may not be the shortest option).

• You may use preexisting solutions, as long as you credit the original author of the program.

• Standard loopholes are otherwise disallowed.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf; these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

## Catalogue

var QUESTION_ID=58615;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=30525;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(index,answers){return"https://api.stackexchange.com/2.2/answers/"+answers.join(';')+"/comments?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){answers.push.apply(answers,data.items);answers_hash=[];answer_ids=[];data.items.forEach(function(a){a.comments=[];var id=+a.share_link.match(/\d+/);answer_ids.push(id);answers_hash[id]=a});if(!data.has_more)more_answers=false;comment_page=1;getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){data.items.forEach(function(c){if(c.owner.user_id===OVERRIDE_USER)answers_hash[c.post_id].comments.push(c)});if(data.has_more)getComments();else if(more_answers)getAnswers();else process()}})}getAnswers();var SCORE_REG=/<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;var OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(a){return a.owner.display_name}function process(){var valid=[];answers.forEach(function(a){var body=a.body;a.comments.forEach(function(c){if(OVERRIDE_REG.test(c.body))body='<h1>'+c.body.replace(OVERRIDE_REG,'')+'</h1>'});var match=body.match(SCORE_REG);if(match)valid.push({user:getAuthorName(a),size:+match[2],language:match[1],link:a.share_link,});else console.log(body)});valid.sort(function(a,b){var aB=a.size,bB=b.size;return aB-bB});var languages={};var place=1;var lastSize=null;var lastPlace=1;valid.forEach(function(a){if(a.size!=lastSize)lastPlace=place;lastSize=a.size;++place;var answer=jQuery("#answer-template").html();answer=answer.replace("{{PLACE}}",lastPlace+".").replace("{{NAME}}",a.user).replace("{{LANGUAGE}}",a.language).replace("{{SIZE}}",a.size).replace("{{LINK}}",a.link);answer=jQuery(answer);jQuery("#answers").append(answer);var lang=a.language;lang=jQuery('<a>'+lang+'</a>').text();languages[lang]=languages[lang]||{lang:a.language,lang_raw:lang.toLowerCase(),user:a.user,size:a.size,link:a.link}});var langs=[];for(var lang in languages)if(languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function(a,b){if(a.lang_raw>b.lang_raw)return 1;if(a.lang_raw<b.lang_raw)return-1;return 0});for(var i=0;i<langs.length;++i){var language=jQuery("#language-template").html();var lang=langs[i];language=language.replace("{{LANGUAGE}}",lang.lang).replace("{{NAME}}",lang.user).replace("{{SIZE}}",lang.size).replace("{{LINK}}",lang.link);language=jQuery(language);jQuery("#languages").append(language)}}
body{text-align:left!important}#answer-list{padding:10px;width:290px;float:left}#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table>

• Nothing can be printed to STDERR. Is this true only when running, or also when compiling (assuming that is a separate step?) – AShelly Sep 24 '15 at 20:47
• @AShelly Only when running – Beta Decay Sep 24 '15 at 20:48
• I’m not sure I like the fact that you hardcoded the 100 into the challenge. That way, a program that just generates the expected output is a valid entry, but is not interesting for this challenge. I think the challenge should expect the program to input the number of items to output. – Timwi Sep 24 '15 at 23:28
• @Timwi While I agree that it would make it (only slightly) more interesting, I've very often seen FizzBuzz as strictly 1 to 100 (on Wikipedia and Rosetta Code, for example). If the goal is to have a "canonical" FB challenge, it makes sense. – Geobits Sep 25 '15 at 0:50
• A "vanilla fizzbuzz" sounds delicious. – Reinstate Monica -- notmaynard Sep 25 '15 at 15:12

## Python 3, 62 bytes

for _ in range(1,101):print("Fizz"*(_%3<1)+"Buzz"*(_%5<1)or _)

Try it online!

class q{static void Main(){for(var i=0;i++<100;)System.Console.WriteLine(i%3*i%5>0?i+"":$"{i%3:;;Fizz}{i%5:;;Buzz}");}}  Try it online! I was wondering how close I could get to the long standing 124 byte C# answer by Pierre-Luc, so I challenged myself to try. After unexpectedly beating it by just one byte (123 bytes, Try it online!), I took the advice from @LiamK's three year old comment and used string interpolation to shave off another 4 bytes. I'm genuinely surprised by how well this worked out! # K (oK), 4946 43 bytes Solution: 0:{$[a:,/$&FizzBuzz!~5 3!'x;a;x]}'1+!100  Try it online! Explanation: 0:{$[a:,/$&FizzBuzz!~5 3!'x;a;x]}'1+!100 / the solution !100 / range 0..99 1+ / add 1 { }' / apply lambda {} to each number$[                        ; ; ]         / conditional, $[if;then;else] 5 3!'x / apply modulo (!) of each 5 and 3 to the input x ~ / not (0->1, anything else->0) FizzBuzz! / turn results into a dictionary & / keys where true$                                 / convert to strings
,/                                  / flatten
a:                                    / save as a
a            / result if a is not empty - so Fizz / Buzz
x          / result if a is empty - so 1, 2, 4
0:                                         / print to stdout


Notes:

• -6 bytes thanks to @ngn with a new approach
• 2 2/ -> 2/­­­­, @' -> ' – ngn Oct 1 '18 at 3:48
• it produces the same output without the $ – ngn Oct 2 '18 at 13:13 • FizzBuzzFizzBuzz -> a,,,/$a:FizzBuzz – ngn Oct 2 '18 at 13:18
• and here's a slightly shorter one abusing "where" on dicts: 0:{$[a:,/$&FizzBuzz!~5 3!'x;a;x]}'1+!100 – ngn Oct 2 '18 at 13:37

# APL(NARS), 44, 43, 39 chars 78 bytes

⊃{⍱/z←0=3 5∣⍵:⍕⍵⋄∊z/'fizz' 'buzz'}¨⍳100


I had seen other APL solutions, so I copied the way. In the follow APL code, ←A here suppress the output of A.

←{⎕←∊{∨/j←0=3 5∣⍵:j/'fizz' 'buzz'⋄⍵}⍵}¨⍳100

{⎕←∊{∨/j←0=3 5∣⍵:j/'fizz' 'buzz'⋄⍵}⍵⋄⍬}¨⍳100 This above should return at end 100 void list, but it seems they are not showed at last here.

{⎕←{×+/j←0=3 5∣⍵:⊃,/j/'fiz' 'buz'⋄⍵}⍵⋄⍬}¨⍳100 This just above has one error because fiz and buz should be fizz and buzz

{⎕←{0<+/j←0=(3 5)∣⍵:⊃,/j/('fiz' 'buz')⋄⍵}⍵⋄⍬}¨⍳100

:for i:in⍳100⋄{0<+/j←0=(3 5)∣⍵:⊃,/j/('fiz' 'buz')⋄⍵}i⋄:endfor

• Ever so slightly golfed (and adding the missing "z"s): ⊃{∨/j←0=3 5∣⍵:∊j/'fizz' 'buzz'⋄⍕⍵}¨⍳100 – Adám Dec 7 '17 at 23:45

# Dart, 80 bytes

f({i=0}){for(;i++<100;)print((i%3>0?'':'Fizz')+(i%5>0?(i%3>0?'$i':''):'Buzz'));} f({i=0}){for(;i++<100;)print("${i%3>0?'':'Fizz'}${i%5>0?(i%3>0?i:''):'Buzz'}");} f({i=0}){for(;i++<100;)print(i%15<1?'FizzBuzz':i%5<1?'Buzz':i%3<1?'Fizz':'$i');}


Try it online!

# Alchemist, 101 bytes

0x+f+b->Out__+x+b
0x+0f->Out_"Fizz"+2f+x
0x+0b+f->Out_"Buzz"+5b+x
x+0b->f
x+b+a->_+Out_"\n"!99a+2f+4b


Try it online!

Takes a few confusing shortcuts in order to reuse the Buzz for FizzBuzzs.

### Explanation:

!99a+2f+4b           # Initialise the program with
# 99a (overall counter)
# 2f (Fizz counter)
# 4b (Buzz counter)
# 1_ (num counter)

0x+f+b->Out__+x+b        # If there's a Fizz and Buzz counter, print the current number
# Also decrement the Fizz counter
0x+0f->Out_"Fizz"+2f+x   # If there's no Fizz counter, print Fizz
# And reset the Fizz counter
0x+0b+f->Out_"Buzz"+5b+x # If there's no Buzz counter and there is a Fizz counter, print Buzz
# Reset the Buzz counter
# And decrement the Fizz counter

# After we've printed any of these, set the x flag
x+0b->f                  # If there is also no Buzz counter, go back to the Buzz printer
# This is to ensure the Buzz check comes after the Fizz check
x+b+a->_+Out_"\n"        # Otherwise, decrement the total counter
# Decrement the Buzz counter
# Increment the num counter
# And print a newline


# JavaScript, 7371 65 bytes

for(i=1;i<101;i++)console.log((i%3?"":"Fizz")+(i%5?"":"Buzz")||i)

• This was my first answer, what was the problem with the format? – Diego Torres Sep 25 '15 at 13:57
• Generally, language and size headers should be a header. Also, your current code doesn't seem to work, but you can fix it by replacing console.info with writeln (I tested it here and it worked.) – ASCIIThenANSI Sep 25 '15 at 13:59
• Do I need to specify the size or only the language? writeln is not valid in JavaScript, console.info is like console.log; both are valid. – Diego Torres Sep 25 '15 at 14:08
• Ah, OK, didn't realize that about writeln. You have to specify both the language and the size, on the same line. Also, I would reccommend using console.log if possible, that'll save you an extra byte. – ASCIIThenANSI Sep 25 '15 at 14:13
• Also, welcome to PPCG! – AdmBorkBork Sep 25 '15 at 14:13

# Brachylog, 48 bytes

100⟦₁{f{∋15∧"FizzBuzz"|∋3∧"Fizz"|∋5∧"Buzz"|t}ẉ}ᵐ


Try it online!

Probably not golfed too well but it works.

C++ 123 122 bytes -1 thanks to JonathanFrech

#import<iostream>
#define s std::cout<<
main(){for(int i;100-i++;s(i%3?"":"Fizz")<<(i%5?"":"Buzz")<<'\n')i%3*i%5?s i:s"";}

• You can move the declaration of i inside the loop. Furthermore, is this variables initial value guaranteed to be zero? – Jonathan Frech Mar 22 '19 at 14:36
• @JonathanFrech I read somewhere that global ints are automatically initialized to 0 – Yoris Mar 22 '19 at 20:53

## Scheme, 118 bytes

(for-each(lambda(i)(printf"~a~a~%"(if(=(mod i 3)0)'Fizz"")(if(=(mod i 5)0)'Buzz(if(=(mod i 3)0)""i))))(cdr(iota 101)))


Try it online!

Ungolfed:

(for-each
(lambda (i)
(printf
"~a~a~%"
(if (= (mod i 3) 0) 'Fizz "")
(if (= (mod i 5) 0) 'Buzz
;; else
(if (= (mod i 3) 0) "" i))))
(cdr (iota 101)))


# C, 98 94 bytes

i;main(){for(;++i<101;)i%3*i%5?printf("%d\n",i):printf("%s%s\n",i%3?"":"Fizz",i%5?"":"Buzz");}


Pretty simple stuff...

Thanks to Yoris Fresh for helping me save a couple bytes. Thanks to Jerry Jeremiah for pointing out a mistake in the ungolfed version.

Ungolfed:

i;
main() {
for (; ++i < 101;)
i % 3 && i % 5 ?
printf("%d\n",i) :
printf("%s%s\n", i % 3 ? "" : "Fizz", i % 5 ? "" : "Buzz");
}

• the ungolfed version increments i twice each loop. – Jerry Jeremiah Jun 4 '19 at 3:33

# 33, 60 bytes

1asz'Fizz'{tlot}t[3rznpn1cztsl5rz"Buzz"npn1tlaz''nqtl1aztsi]


Explanation:

1asz          (Initialise the counter with 1)
'Fizz'{tlot}t (Create function 'Fizz' to print current number)
[             (Start of loop)
3rz           (Check if divisible by 3)
np            (If so, print 'Fizz')
n1czts        (Store result for later)
5rz           (Check if divisible by 5)
"Buzz"np      (If so, print 'Buzz')
n1tlaz        (Check if divisible by neither by retrieving the value from earlier)
''nqt         (If neither 'Fizz' nor 'Buzz' was printed, print the number)
l1azts        (Restore our counter and increment it)
i]            (Print a newline and repeat from the start of the loop)


## Julia, 87 Bytes

for i in 1:100;println(i%3<1 ? "Fizz"*(i%5<1 ? "Buzz" : "") : (i%5<1 ? "Buzz" : i));end


for i in 1:100
if i%3 < 1
print("Fizz")
if i%5 < 1
println("Buzz")
else
println()
end
elseif i%5 < 1
println("Buzz")
else
println(i)
end
end


Not sure if there's already a Julia submission here. Also my first time golfing c:

Indirect thanks to @Najkin because I saw their reply to a C# submission saying that you can use <1 instead of ==0 and that helped me save 3 bytes over my previous 90-byte solution!

BTW if you see any "unnecessary" spaces, they're actually necessary as Julia would throw a syntax error without them. (Why?!)

• oh I just realized there's a 72-byte Julia submission lol – Sagittarius Aug 28 '19 at 14:02

## Hoon, 115 bytes

This is a Hoon say generator which can be used to write the output to a file from the dojo.

turn is Hoon's map, it takes a list from 1..100 generated via (gulf 1 100) and uses string interpolation and the 'null check' conditional rune ?~ to generate either "Fizz", "Buzz" or "FizzBuzz" according to the value of x. This is paired with the value of x as a string <x> and then - and + are used to select the fizzbuzz string if not empty, otherwise the number string from the pair.

:-
%say
|=
*
:-
%txt
%+
turn
(gulf 1 100)
|=
x=@
=>
"{?~((mod x 3) "Fizz" ~)}{?~((mod x 5) "Buzz" ~)}"^<x>
?~
-
+
-


# Wren, 78 bytes

It turns out that this is pretty hard to golf.

for(i in 1..100)System.print(i%15==0?"FizzBuzz":i%5==0?"Buzz":i%3==0?"Fizz":i)


Try it online!

# Python 3, 80 bytes

for x in range(1,101):print(("Fizz"if x%3==0else"")+("Buzz"if x%5==0else"")or x)


## MC6000 ASM (Shenzhen I/O), 133 Bytes

add 1
mov acc x3
mov 51 x2
mov acc x2
mov 3 x2
teq x2 0
+mov 1 x1
mov 51 x2
mov acc x2
mov 5 x2
teq x2 0
+mov 2 x1
slp 1
mov -999 x1


Uses an MC4010 co-processor on x2, numeric display on x3, and a custom fizzbuzz display on x1.

"Hardware":

Custom LCD:

Technically doesn't follow the rules as MCxxxx don't have a STDOUT, but I did the best I could.

# APL, 52 chars/bytes

generate integers from 1 to n

⍳


b is a 2 by n boolean matrix highlighting multiples of 3 and 5

b←0=3 5∘.|⍵


c is a boolean vector highlighting multiples of either 3 or 5

c←∨⌿b


format each integer into a character vector

⍕¨⍵


where a number is a multiple of either 3 or 5...

@{c}


...put either Fizz or Buzz (i.e. discard the last 4, the first 4 or no character at all from the string "FizzBuzz" according to b)

(↓∘'FizzBuzz'¨¯4 4+.×c/b)


transform the nested vector into a matrix

↑


## Wd, 29 23 bytes

&ó╞╟↨5O╓46N☻»½_49ƒZÄ▬«Σ


A raw source is here.

After decompression:

2^                         E % Foreach in the 1..100 range
a3m!                 % If the current item is divisible by 3:
"Fizz"    *                % Return "Fizz"
"Buzz"a5m!*     % If the current item | 3 -> "Buzz".
+    % Join those results
a|  % Logical OR this result with the current item
% Implicit print


# Keg, 5840+4 43 bytes

1(d|0&:3%[|Fizz,⑹]:5%[|Buzz,⑹]&[|:.]
,⑨


Try it online!

-14 bytes thanks to @EdgyNerd and then -1 byte due to using register

### 58 bytes

1(d|:\“%0=[FizzBuzz|:5%0=[Buzz|:3%0=[Fizz|:⅍]]],
,⑨)


Try it online!

String compression and string formatting are both useless here. Just a standard implementation of Fizzbuzz in Keg.

• Idea to golf some bytes: couldn't you push an empty string, and then concatenate 'Fizz' if it's a multiple of 3, and then concat 'Buzz' if it's a multiple of 5, to save the FizzBuzz in your code (and probably some other bytes) – EdgyNerd Dec 1 '19 at 11:08

# Erlang (escript), 166 bytes

i(A,B,C,D)->if A==B->C;1<2->D end.
f(X)->i(X rem 3,0,"Fizz","")++i(X rem 5,0,"Buzz","").
z(0)->"";z(X)->z(X-1)++"~n"++i(f(X),"",integer_to_list(X),f(X)).
z()->z(100).


Try it online!

# Bash, 58 bytes

eval i={1..100}';a=([i%3]=Fizz [i%5]+=Buzz);echo ${a-$i};'


Try it online!

## Wn, 22 21 bytes

Seems like nobody ties with Dennis. Just 1 byte away...

♥:jΓƒ¢D╦Γ%%lOvhI♣BAE§


Uncompressed:

3m!?SY%?*?SZ%?a5m!*+a|2^N


## Explanation

                      2^N For Each: 1 to 100
3m!                       Repeat whether current item is divisible by 3
?SY%?*                 Repeat that bool by the compressed "Fizz"
?SZ%?a5m!*       Do that for "Buzz" too
+      Join the results
a|    If the result is empty,
turn it to the current item value.

Flag: n                   Join the resulting list with newlines
Implicit output
$$$$


# Python 2, 73 77 bytes, link

edit:

Even shorter, thanks to @Dingus + removing parenthesis:

for n in range(1,101):print[[n,"Buzz"],["Fizz","FizzBuzz"]][n%3<1][n%5<1]


original:

Here's my matrix-inspired approach:

for n in range(1,101):
print([[n,"Buzz"],["Fizz","FizzBuzz"]][n%3<1][n%5<1])


It avoids double checking modularity for 15. Written out a bit more elaborately, this becomes

for n in range(1,101):
matrix=[[n     ,"Buzz"    ],
["Fizz","FizzBuzz"]]

print(matrix[n%3==0][n%5==0]) # checking ==0 adds 1 byte versus <1.

• Welcome to the site, and nice first answer! You might like to include a link to Try It Online (TIO). It seems you can save 2 bytes by putting all your code on one line. – Dingus Aug 3 at 11:25
• Thank you @Dingus for the encouragement and improvement. I also removed the parenthesis since it's Python 2. – Thomas Aug 3 at 11:50

# Scala, 103 94 bytes

for{i<-1 to 100;s=(if(i%3==0)"Fizz"else"")+(if(i%5==0)"Buzz"else"")}println(if(s=="")i else s)


thx @Ben (shortened by 9 bytes)

• You can save 9 bytes by using a for comprehension: for{i<-1 to 100;s=(if(i%3==0)"Fizz"else"")+(if(i%5==0)"Buzz"else"")}println(if(s=="")i else s) – Ben Oct 2 '15 at 20:57

# Javascript ES6, 77 chars

"\n".repeat(100).replace(/(?=\n)/g,(m,i)=>(++i%3?m:"Fizz")+(i%5?m:"Buzz")||i)


Test:

"\n".repeat(100).replace(/(?=\n)/g,(m,i)=>(++i%3?m:"Fizz")+(i%5?m:"Buzz")||i) == document.querySelector("pre").textContent

• Here's my ES6 attempt, with parts stolen from yours (89 chars): "0".repeat(99).split(0).map((m,i)=>{return(++i%3?m:"Fizz")+(i%5?m:"Buzz")||i}).join("\n") – starbeamrainbowlabs Jan 7 '16 at 6:48
• @starbeamrainbowlabs, why do you use {return ...} instead of expression? – Qwertiy Jan 7 '16 at 10:21
• Because I couldn't get the expression to work :( – starbeamrainbowlabs Jan 7 '16 at 16:20
• Save a byte by using template strings + literal newline at front. – Mama Fun Roll Jan 29 '16 at 0:34

# Elixir, 182 bytes

import Stream
f=fn(n)->(zip(cycle(["","","fizz"]),cycle(["","","","","buzz"]))|>zip(iterate(1,&(&1 + 1)))|>map(fn{{"",""},n}->n
{{p,o},_}->p<>o end))|>take(n)|>Enum.each(&IO.puts/1)end


LiveDemo

Calling: f.(100)

# ///, 229 bytes

/x/Buzz//b/
x//f/
Fizz/1
2f
4bf
7
8fb
11f
13
14fx
16
17f
19bf
22
23fb
26f
28
29fx
31
32f
34bf
37
38fb
41f
43
44fx
46
47f
49bf
52
53fb
56f
58
59fi
61
62f
64bf
67
68fb
71f
73
74fx
76
77f
79bf
82
83fb
86f
88
89fx
91
92f
94bf
97
98fb

• Out-golfed – Esolanging Fruit May 15 '17 at 2:58
• @Challenger5 Well done. – Leaky Nun May 15 '17 at 2:59
• @LeakyNum I have A CJam script that finds common substrings in the input. It's useful for /// golfing. – Esolanging Fruit May 15 '17 at 5:55

## JavaScript (using external library) (90 bytes)

x=>_.Range(1,100).Select(x=>x%3==0?(x%5==0?"FizzBuzz":"Fizz"):x%5==0?"Buzz":x).WriteLine()


Code explanation: Creates a range starting at 1 and extending 100 elements. Select maps the item according to the predicate. First check if divisible by 3, if so check if divisible by 5. If so, select "FizzBuzz", else select "Fizz". Otherwise,check if divisible by 5. If so, select "Buzz", else just select the number. WriteLine is built into the library, and it writes each element on its own line

# DUP, 76 bytes

[$$3/%[]['F,'i,'z,'z,]?\5/%[]['B,'u,'z,'z,]?*[.][]?10,]c:0[100<][1+c;!]# Explanation of program flow, code blocks: DUP has two default truth values: -1 (true, all bits set) and 0 (false, no bits set). For conditional evaluations every nonzero value is accepted as true, comparisons themselves lead to either -1 or 0. DUP has two conditional expressions, if-then-else and a while loop: [execute if not false][execute if false]?. E.g. 1['t,]['f,]? prints t to STDOUT, because 1 is not false. [condition][execute while not false]#. E.g. 5[0>][.1-]# prints the numbers 5,4,3,2,1 to STDOUT. The condition block tests the top stack value if it’s greater than 0, the execute block prints the number and decrements it. The condition that’s checked is always the topmost stack element, which gets popped off the stack during the check. [$$3/%${dup,dup,push 3, moddiv, pop, dup} [] {if condition true do nothing} ['F,'i,'z,'z,]? {if condition false print Fizz} \5/%$                               {swap, push 5, moddiv, pop, dup}
[]                                  {if condition true do nothing}
['B,'u,'z,'z,]?                   {if condition false print Buzz}
*                                   {mul}
[$.] {if condition true dup, print to STDOUT} []? {if condition false do nothing} 10, {push 10, print char to STDOUT (newline)} ]c: {define function c} 0 {push 0} [$100<]                                 {while dup < push 100 true}
[1+c;!]#                         {do push 1, add, execute function c}


Step by step:

instruction             stack
0                       0
[
$0,0 100 0,0,100 < 0,-1 ] 0 [ 1 0,1 + 1 increment counter c; 1,0 0=start address of function c ! execute c [$$3 1,1,1,3 / 1,1,1,0 mod,div operator (n mod 3, n div 3) % 1,1,1 /% → mod$                       1,1,1,1         result of n%3 used as flag for later check
[]                      1,1,1           condition true→do nothing
['F,'i,'z,'z,]?                         skipped
\                       1,1,1           swap top and 2nd stack elements
5                       1,1,1,5
/                       1,1,1,0         mod,div operator
%                       1,1,1           /% → mod
$1,1,1,1 n%5 flag [] 1,1,1 condition true → do nothing ['B,'u,'z,'z,]? skipped * 1,1 multiply %3 and %5 flags, result is only >0 if neither %3 nor %5 are 0. [ 1 if condition (flag)>0$                      1,1             dup
.]                    1               print number to STDOUT: '1'
[]?                                     skipped

back to while loop

[
\$                       1,1
100                     1,1,100
<                       1,-1
]                       1
[
1                       1,1
+                       2               increment counter
c;                      2,0             0=start address of function c
!                       execute c

...


A full description of all operators and program flow can be found at my GitHub repository, together wtih my Julia interpreter of DUP.

An online Javascript implementation showing useful debug information can be found here.

A rather terse introduction can be found on the esolangs.org DUP page.