g | x | w | all
Bytes Lang Time Link
076powershell240523T195107Zgroser
103Kotlin200610T144316ZLamorak
117Java OpenJDK 8200610T034159Zbranboye
098C gcc200608T202702ZNoodle9
047Brachylog200609T110306ZUnrelate
079Python 2200609T045917ZDion
043APL Dyalog Unicode200609T061150ZBubbler
076Python 3200608T184649ZSurculos
03305AB1E200608T155902ZKevin Cr
039Charcoal200608T183853ZNeil
063Bash200608T180903ZMitchell
056Retina 0.8.2200608T173154ZNeil
026Jelly200608T165734ZJonathan
064JavaScript ES6200608T161122ZArnauld
047perl M5.010 n200608T160944ZAbigail

powershell, 76 bytes

[regex]::Match("pwsh`nfizz`nbuzz`n'ave a banana","(?s)(?<=$($_)\n).*$")|% v*

Try it online!

Kotlin, 103 bytes

fun f(x:String){listOf("fizz","buzz","'ave a banana").fold("Kotlin"){a,b->if(x==a){println(b);f(b)};b}}

Try it online!

Java (OpenJDK 8), 117 bytes

void a(String s){System.out.println(s=s=="fizz"?"buzz":s=="buzz"?"'ave a banana":s=="java"?"fizz":"");if(s!="")a(s);}

Try it online!

C (gcc), 115 \$\cdots\$ 105 98 bytes

Saved 4 bytes thanks to ceilingcat!!!

Saved 7 bytes thanks to Neil!!!

i;*y[]={"c","fizz","buzz","'ave a banana"};f(char*s){for(i=0;i<3;)strcmp(s,y[i++])||puts(s=y[i]);}

Try it online!

Brachylog, 52 47 bytes

∧"Brachylog
fizz
buzz
'ave a banana"ṇ;?⟨a₁h⟩b~ṇ

Try it online!

The predicate fails on inputs on which it should "terminate". If outputting an unbound variable is more desirable, +2 bytes for .∨; if an empty string is necessary, +1 on top of that for .

Python 2, 102 79 bytes

a='fizz'
b='buzz'
def f(s):t={'Python':a,a:b,b:"'ave a banana"}[s];print t;f(t)

Try it online!

Uses a different approach from the other answer, recursive function

Edit: Thanks @SurculoseSputum for saving 23 bytes!

APL (Dyalog Unicode), 43 bytes

'APL' 'fizz' 'buzz' '''ave a banana'(↑⍳↓⊣)⊂

Try it online!

List of string literals is quite expensive...

How it works

S←'APL' 'fizz' 'buzz' '''ave a banana'  ⍝ Let's call this array S
S(↑⍳↓⊣)⊂  ⍝ The function
S( ⍳  )⊂  ⍝ 1-based index of the input in S, 5 if not found
    ↓⊣    ⍝ Drop that many items from the start of S
  ↑       ⍝ Convert the remaining items to be placed on each line

Python 3, 77 76 bytes

t="Python","fizz","buzz","'ave a banana"
*map(print,t[t.index(input())+1:]),

Try it online!

Takes input from STDIN, and print the results to STDOUT.

05AB1E, 46 33 bytes

’
05AB1E
fizz
ÒÖ
'ž™ a æé’I¶.ø¡¦θ

-13 bytes by porting @Abigail's Perl answer, so make sure to upvote her!!

Outputs [] for invalid inputs.

Try it online.

Original 46 bytes approach:

"fizz"U•äƵí•hRQiX=}XQi'ÒÖ=}'ÒÖQi’'ž™ a æé’,}õ?

Outputs nothing for invalid inputs.

Try it online.

Explanation:

’
05AB1E
fizz
ÒÖ
'ž™ a æé’         '# Push dictionary string "\n05AB1E\nfizz\nbuzz\n'ave a banana"
         I         # Push the input
          ¶.ø      # Surround it with leading and trailing newline
             ¡     # Split the string on this
              ¦    # Remove the first part (for invalid inputs)
               θ   # Pop and only leave the last part (or an empty list)
                   # (and output it implicitly as result)

"fizz"U            # Puts "fizz" in variable `X`
•äƵí•              # Push compressed integer 14793296
     h             # Convert it to hexadecimal: E1BA50
      R            # Reverse it to 05AB1E
       Qi  }       # If the (implicit) input-string is equal to this:
         X         #  Push "fizz" from variable `X`
          =        #  Print it with trailing newline without popping
X                  # Push "fizz" from variable `X`
 Qi    }           # If the top of the stack equals "fizz",
                   # which will use the (implicit) input if the stack is empty:
   'ÒÖ            '#  Push dictionary string "buzz"
      =            #  Print it with trailing newline without popping
'ÒÖQi           } '# If the top of the stack (or implicit input) equals "buzz":
     ’'ž™ a æé’   '#  Push dictionary string "'ave a banana"
               ,   #  Pop and print it
õ?                 # Print "" without newline
                   # (for invalid input, which otherwise would be output implicitly)

See this 05AB1E tip of mine (sections How to use the dictionary? and How to compress large integers?) to understand why •äƵí• is 14793296; 'ÒÖ is "buzz"; and ’'ž™ a æé’ is "'ave a banana".

Charcoal, 39 bytes

≔⪪“Jε(h&]⦄_⁷¦⊗‹f·ⅈ⦄⊗x⍘ς3➙A⁸“↑”¶υΦυ№…υκθ

Try it online! Link is to verbose version of code. Explanation:

≔⪪“Jε(h&]⦄_⁷¦⊗‹f·ⅈ⦄⊗x⍘ς3➙A⁸“↑”¶υ

Split the string Charcoal\nfizz\nbuzz\n'ave a banana on newlines and save the result in a variable.

Φυ№…υκθ

Filter on the result and show only those entries that appear after the input.

Bash, 63 bytes

bash=fizz
fizz=buzz
buzz="'ave a banana"
echo ${x=${!1}}&&$0 $x

Try it online!

This requires . to be in your PATH. If that's not acceptable, then replace $0 with ./$0 (assuming the program is being run from the current working directory) at the cost of 2 bytes (65 bytes total).

Input is passed as an argument, output is on stdout. The language name is entered as bash.

(There's spurious output to stderr, but that's OK under our generic rules.)

Retina 0.8.2, 56 bytes

$
¶Retina¶fizz¶buzz¶'ave a banana
^(.*¶)(.*¶)*?(\1|.*$)

Try it online! Link includes test cases. Explanation:

$
¶Retina¶fizz¶buzz¶'ave a banana

Append the possible inputs and outputs.

^(.*¶)(.*¶)*?(\1|.*$)

Try to delete only up to and including a line matching the original input. If this is not possible, then just delete everything.

Jelly, 26 bytes

“Çȥȧ>$ỌĿɦ@⁴Ƙ½Æ/ṠṫḞƇ»Ỵṣ⁸ḊẎY

Try it online!

How?

“...»Ỵṣ⁸ḊẎY - Link: list of characters, W
“...»       - compressed string = "Jelly\nfizz\nbuzz\n'ave a banana"
     Ỵ      - split at newlines = ["Jelly","fizz","buzz","'ave a banana"]
      ṣ     - split at:
       ⁸    -   chain's left argument, W  e.g. "Jelly" -> [[],["fizz","buzz","'ave a banana"]]
        Ḋ   - dequeue                                   = [["fizz","buzz","'ave a banana"]]
         Ẏ  - tighten                                   = ["fizz","buzz","'ave a banana"]
          Y - join with new lines                       = "fizz\nbuzz\n'ave a banana"

JavaScript (ES6), 64 bytes

Expects "js" for the language name. Returns an array of strings.

s=>[k="js","fizz","buzz","'ave a banana"].filter(w=>k*(k|=s==w))

Try it online!

perl -M5.010 -n, 47 bytes

"Perl\nfizz\nbuzz\n'ave a banana"=~/\b$_/;say$'

Try it online!

Prints whatever is following the input, or nothing if there is no match. Assumes input is newline terminated.