[Question]
  [
My colleague recently sent me the following piece of JavaScript as a joke:
```
let butScript = (nrOfButs) => {
    for(var i = 0; i < nrOfButs; i++){
        if(i % 3 == 0){
            console.log("Yeah")
        }
        if(i % 2 == 0){
            console.log("But")
        }
        if(i % 3 == 1){
            console.log("No")
        }
    }
}
```
Since the code was written during work hours, it was obviously a huge waste of company resources. To prevent similar occurrences in the future, we must minimize the waste of worked hours. And since it is common knowledge that a shorter program is faster to write, we must golf this code to be as short as possible!
## Input
A single non-negative integer. You must not handle faulty input.
## Output
Your program must produce output identical to that of the script above. You should output one word per line, and the number of words should be consistent with the original script. 
It is permissible to include non-newline whitespace characters at the end of each line (but not at the beginning) since they are invisible. One additional newline character is permissible at the very end of the output.
## Examples
```
Input: 0
Output:
Input: 1
Output:
Yeah
But
Input: 2
Output:
Yeah
But
No
Input: 10
Output:
Yeah
But
No
But
Yeah
But
No
Yeah
But
No
But
Yeah
```
  
[Answer]
# Excel, 78 bytes
Assumes input in cell A1, and that Wordwrap formatting is turned on for cell. Use Alt+Enter to add line feeds within the string and note the whitespace. Only handles input up to 3570 due to limit of REPT function (Good luck getting a cell to be that tall, though).
```
=LEFT(REPT("Yeah
But
No      
But     
Yeah    
But
No           
",595),A1*9)
```
Reprinting, with periods for whitespace
```
=LEFT(REPT("Yeah
But
No......
But.....
Yeah....
But
No...........
",595),A1*9)
```
How it works:
The pattern repeats every 6 numbers: 
```
0 = Yeah and But      Yeah + linefeed + But + linefeed
1 = No                No + 6 whitespace + line feed
2 = But               But + 5 whitespace + linefeed
3 = Yeah              Yeah + 4 whitespace + linefeed
4 = But and No        But + linefeed + No + 3 whitespace
5 = Blank             8 whitespace + linefeed
```
Each of these can be expressed with 9 characters, so a string is made of 54 characters (9 \* 6), then repeated as large as Excel will allow. Then it takes the left 9 \* (number of input) characters as the output.
Linefeed for the "but and no" one is placed after the blank so that the Yeah for #6, #12, (etc) is formatted to the left rather than the right, and so that there is no blank linefeed added every 6th line for that item.
[![Output](https://i.stack.imgur.com/cWMSb.png)](https://i.stack.imgur.com/cWMSb.png)
[Answer]
# JavaScript (ES6), ~~59~~ 57 bytes
```
f=n=>n?f(n-1)+[s=n&1?`But
`:'',`Yeah
`+s,s+`No
`][n%3]:''
```
[Try it online!](https://tio.run/##Zc6xCsIwFIXhPU9xF01C0tLoZkkLgmt3KYWE2rRKuZGmuojPHoOjnvH/lnOzTxv65XpfM/SXIUanUVdYO4aZ4qINGreqNsfHSsyBUmnOg52IEUEGYRpPTNfiZt8limVbSCV3UhVd7vxysv3EEHQFLwLQewx@HvLZj4w2oIGCAOTlL2Xf0T9If3iKbx4/ "JavaScript (Node.js) – Try It Online")
### How?
We use a recursive function which goes from \$n\$ to \$1\$ rather than from \$0\$ to \$n-1\$.
As a result, the tests are off by \$1\$ compared to the reference code:
* if \$n\equiv1\pmod 3\$, output *"Yeah"*
* if \$n\equiv1\pmod 2\$, output *"But"*
* if \$n\equiv2\pmod 3\$, output *"No"*
This allows us to store the simpler case \$n\equiv0\pmod 3\$ as the first entry of our lookup array, where we can define \$s\$: a variable holding either `"But\n"` or an empty string.
The two other entries are defined as `"Yeah\n" + s` and `s + "No\n"` respectively.
*Note:* By iterating from \$n-1\$ to \$0\$, we could define \$s\$ in the first entry just as well, but that would cost [two extra parentheses](https://tio.run/##ZY49D4IwFAD3/oq36GvTloBukEJi4spuCEkbBNGQV0PRxfjb68eoN94td3F3F7r5fF00@WMf42DIlKR1NXASsrGH3o3MSh4MrbMKMbe728KsUEHa2jOrQtvQatvmiLFoUpWpjcrSNhn8vHfdyAlMCQ8G0HkKfuqTyZ841mAAQQKJ4jfpL/gXPj9v@RTxBQ).
### Commented
```
f = n =>            // n = input
  n ?               // if n is not equal to 0:
    f(n - 1) +      //   prepend the result of a recursive call with n - 1
    [               //   define our lookup array:
      s = n & 1 ?   //     1st entry: if n is odd:
        `But\n`     //       set s to "But"
      :             //     else:
        '',         //       set s to an empty string
      `Yeah\n` + s, //     2nd entry: "Yeah" followed by s
      s + `No\n`    //     3rd entry: s followed by "No"
    ][n % 3]        //   append the correct entry for this iteration
  :                 // else:
    ''              //   return an empty string and stop recursion
```
[Answer]
# [LOLCODE](http://lolcode.org/), 257 bytes
```
HAI 1.2
I HAS A B
GIMMEH B
B IS NOW A NUMBR
I HAS A C ITZ 0
IM IN YR L UPPIN YR C TIL BOTH SAEM B AN C
I HAS A D ITZ MOD OF C AN 3
D
WTF?
OMG 0
VISIBLE "Yeah"
OIC
MOD OF C AN 2
WTF?
OMG 0
VISIBLE "But"
OIC
D
WTF?
OMG 1
VISIBLE "No"
OIC
IM OUTTA YR L
KTHXBYE
```
[Try it online!](https://tio.run/##bY5NDoIwFIT37xQTDmAAD2Ba/voibQkUEXdGSVyQsNHzYwMJsnA3mflmMuM0PqbnMM9KMKJDTAwlGghIKljrTHkhwQ2M7bxrWi3rjUnA7oaQWIMN@hol2qpaZQLHJaR1Co3INCSEQbJV06WqbQqbe9ZnR0qpc/mJrC785oUblmWGoB/ur4AsJ7Sn47@s/LxXdDcV/WIzran/a1vnxHKZzk5dZZ/NcxR@AQ "LOLCODE – Try It Online")
[Answer]
# [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php), ~~315~~ ~~304~~ ~~300~~ ~~277~~ 276 bytes
Thanks to *@JoKing* for -11 bytes (reducing the amount of labels used from 8 to 7), and -24 more bytes (changing the general flow of the program and reducing the amount of labels used from 7 to 5 in the process).
```
[S S S N
_Push_0][T  N
T   T   _Read_STDIN_as_integer][N
S S N
_Create_Label_LOOP][S S S N
_Push_0][T  T   T   _Retrieve][N
T   S S N
_If_negative_jump_to_Label_PRINT][S S S N
_Push_0][T  T   T   _Retrieve][S S S T  T   N
_Push_3][T  S T T   _Modulo][S S S T    S N
_Push_2][T  S S T   _Subtract][N
T   T   T   N
_If_negative_jump_to_Label_SKIP_NO][S S T   T   S T T   T   T   S N
_Push_-94_\n][S S S T   T   T   N
_Push_7_o][S S T    T   T   S T S N
_Push_-26_N][N
S S T   N
_Create_Label_SKIP_NO][S S S N
_Push_0][T  T   T   _Retrieve][S S S T  S N
_Push_2][T  S T T   _Modulo][N
T   S S S N
_If_0_jump_to_Label_SKIP_BUT][S S T T   S T T   T   T   S N
_Push_-94_\n][S S S T   T   S S N
_Push_12_t][S S S T T   S T N
_Push_13_u][S S T   T   S S T   T   S N
_Push_-38_B][N
S S S S N
_Create_Label_RETURN_FROM_BUT][S S S N
_Push_0][S N
S _Duplicate_0][S N
S _Duplicate_0][T   T   T   _Retrieve][S S S T  N
_Push_1][T  S S T   _Subtract][T    T   S _Store][T T   T   _Retrieve][S S S T  T   N
_Push_3][T  S T T   _Modulo][N
T   S S T   N
_If_0_jump_to_Label_YEAH][N
S N
N
_Jump_to_Label_LOOP][N
S S S T N
_Create_Label_YEAH][S S T   T   S T T   T   T   S N
_Push_-94_\n][S S S N
_Push_0_h][S S T    T   T   T   N
_Push_-7_a][S S T   T   T   N
_Push_-3_e][S S T   T   T   T   T   N
_Push_-15_Y][N
S N
N
_Jump_to_Label_LOOP][N
S S S N
_Create_Label_PRINT][S S S T    T   S T S S S N
_Push_104][T    S S S _Add][T   N
S S _Print_as_character][N
S N
N
_Jump_to_Label_LOOP]
```
Letters `S` (space), `T` (tab), and `N` (new-line) added as highlighting only.  
`[..._some_action]` added as explanation only.
[**Try it online**](https://tio.run/##ZY5RCoAwDEO/21PkCHokkYH@CQoev7Zpx0RhW7Mu6d697Vc7j2VtZgBUVES9UruUob2wkQrxJPRE35cfSk92JDyh3nkwH1H8Yui1JsaOAUUAYtUcfp7xgZVEbmTqy5VQxVaX4e5fk7XS8WY2Tw8) (with raw spaces, tabs and new-lines only).
Whitespace is definitely not the right language for this challenge.. In Whitespace both loops and if-statements are made with labels and jumps to labels, and since they aren't if-elseif-else cases but multiple if-cases, ~~it means I will have to jump back after every if, making it quite long~~ it means I will have to slightly modify the checks to skip over some prints (thanks *@JoKing*).
**Explanation in pseudo-code:**
```
Read STDIN as integer, and store it in the heap
Start LOOP:
  Integer i = retrieve integer from heap
  If(i is negative):
    Call function PRINT
  If(i modulo-3 is NOT 2):
    Jump to Label SKIP_NO
  Push "\noN" to the stack
  Label: SKIP_NO
  If(i modulo-2 is 0):
    Jump to Label SKIP_BUT
  Push "\ntuB" to the stack
  Label: SKIP_BUT
  i = i - 1
  Replace i in the heap with this updated value
  If(i modulo-3 is 0):
    Call function YEAH
  Go to next iteration of LOOP
function YEAH:
  Push "\nhaeY" to the stack
  Go to next iteration of LOOP
function PRINT:
  Print top of the stack as character to STDOUT
  Go to next iteration of LOOP (which will enter the if and then
                                comes back to this PRINT again)
```
**Additional explanation:**
In general, it loops from the input down to 0, pushing a newline and the word reversed (so in the order "\noN", "\ntuB", "\nhaeY" instead of "Yeah\n", "But\n", "No\n"). And after the input has looped down to 0 and all the characters are on the stack, it will print those characters in reverse (so the correct output order).
More in depth however: Although we need to print words in the range `(input, 0]`, it will loop in the range `[input, 0)` instead. Because of this, we can use the check `if(i%3 == 2)` for "\noN" (or actually, `if(i%3 != 2)` skip the pushing of "\noN"), and we use the check `if(i%2 != 1)` for "\ntuB" (or actually, `if(i%2 == 0)` skip the pushing of "\ntuB"). Only after these two checks we decrease the iteration `i` by 1. And then do the check `if(i%3 == 0)` to push "\nhaeY", similar as in the JS example code in the challenge description. Skipping with if-not checks instead of going to a label and return from the label with if-checks saved 23 bytes.
Also, in Whitespace character values are stored in the stack as their unicode values (i.e. `10` for new-lines, `65` for 'A', `97` for 'a', etc.). Since I already need to loop over the stack to print the characters, I am also able to [use my Whitespace tip](https://codegolf.stackexchange.com/a/158232/52210) to lower the byte-count by adding a constant to the number values, before printing them as characters.  
This constant is `104` in this case, which is generated with [this Java program](https://tio.run/##dVJNb9swDL37VxA8SVBqZMCKYUmEIhl2MLDkMHcfRVsMcqIm6hzZk@gCwZDf7sm1naRdepEgPvLxkXqP6kldPK5@1/UyV97DXBn7NwIoqyw3S/CkKFxPhVnBNkAsJWfs@vYeFG/SANoAOO2rnECCuh3ej58RYwn8VuW59g2QWNJr7eL59Oev79Mv3z4PIJEfLsenLH36154NscUfCscaPiOTsZm8uxyOjRCdgqMGiTigQSn7qrYu25GGbNQqjNeaZiHgGT@UA5AM5FP/Y2MCUqql/lSsNGs68rmiTawyz7ILw7nAO3sgh9CRUaz/VCr3rORXmC7ubIoj4sIdk0pJ/WPf3eaBuTjXdk0bxmFymPtE0n@rOGE82eqR5ggnIW5etmzPdOdJb@OiorgMG6PcMlwWNnyyJYkiEQgMxblVJGFyjl2PczStikByGOXN3DcQ9nLi56x9FI7Og90nn1PXOMO@8qPENEXB7GR4hdc4wrRX31spG/WOpGJmrHK7tpRZfs4kTshs8v5j@ONAdt15oF2r01Q5GzJwga3qfV3XN1ptollF0aKI/gE) that I've also used to golf [another Whitespace answer of mine before](https://codegolf.stackexchange.com/a/157709/52210). That's also the reason why this part of the code:
```
[S S T  T   S T T   T   T   S N
_Push_-94_\n][S S S T   T   T   N
_Push_7_o][S S T    T   T   S T S N
_Push_-26_N]
```
has the values `-94` for the newline, `7` for the 'o', and `-26` for the 'N'. Because adding the constant of `104` will correctly give our unicode values `10`, `111`, and `78` for these characters respectively.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~85~~ 82 bytes
```
def f(n):
 for i in range(n):yield from['Yeah'][i%3:]+['But'][i%2:]+['No'][i%3^1:]
```
[Try it online!](https://tio.run/##K6gsycjPM/7/PyU1TSFNI0/TikshLb9IIVMhM0@hKDEvPRUkVpmZmpOikFaUnxutHpmamKEeG52pamwVqx2t7lRaAuYZgXl@@RCpOEOr2P8FRZl5JRo5mcUlGmkahgaampr/AQ "Python 3 – Try It Online")
---
# [Python 3](https://docs.python.org/3/), ~~79~~ 76 bytes
Port of [Keeta](https://codegolf.stackexchange.com/users/49088/keeta)'s [Excel answer](https://codegolf.stackexchange.com/a/172064/64121).
```
lambda n:(f"""Yeah
But
No      
But     
Yeah    
But
No{'':11}
"""*n)[:9*n]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPSiNNSUkpMjUxg8uptITLL18BDEAcCAMkBRMBSlerq1sZGtZyATVp5WlGW1lq5cX@LyjKzCvRSNMwNNDU/A8A "Python 3 – Try It Online")
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~63~~ 50 bytes
```
{<<"Yeah But"No But Yeah"But No">>[^$_ X%6].words}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/2sZGKTI1MUPBqbREyS8fRCmA@Eoghl@@kp1ddJxKvEKEqlmsXnl@UUpx7f80DUMDTTs7veLEyv8A "Perl 6 – Try It Online")
Anonymous code block that takes a number and returns a list of lines
### Explanation:
```
{                                                }   # Anonymous code block
 <<"Yeah But"No But Yeah"But No">>  # Create the list of strings:
                                     # Yeah But
                                     # No
                                     # But
                                     # Yeah
                                     # But No
                                  [       ]  # Index into this list
                                   ^$_  # The range from 0 to n-1
                                       X%6  # All modulo 6
                                           .words  # Convert the list to a string 
                                                   # Which joins by spaces
                                                   # And split by whitespace
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 75 bytes
```
f(o,_){for(_=0;o-_;_++%3-1||puts("No"))_%3||puts("Yeah"),1&_||puts("But");}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9NI18nXrM6Lb9II97WwDpfN946Xltb1VjXsKamoLSkWEPJL19JUzNe1RjGj0xNzFDS1DFUi4eJOJWWKGla1/7PTczM0wCapWFoAOICAA "C (gcc) – Try It Online")
---
# [C (gcc)](https://gcc.gnu.org/), 60 + 11 = 71 bytes (using `-D$=||puts(`)
```
f(o,_){for(_=0;o-_;_++%3-1 $"No"))_%3 $"Yeah"),1&_ $"But");}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9NI18nXrM6Lb9II97WwDpfN946Xltb1VjXUEFFyS9fSVMzXtUYyIxMTcxQ0tQxVIsHcpxKS5Q0rWv/5yZm5mkANWsYGoC4/5LTchLTi//ruqjY1tQUlJYUawAA "C (gcc) – Try It Online")
[Answer]
# [05AB1E (legacy)](https://github.com/Adriandmen/05AB1E/tree/fb4a2ce2bce6660e1a680a74dd61b72c945e6c3b), ~~27~~ ~~25~~ 24 bytes
Saved 1 byte thanks to *Kevin Cruijssen*.
```
F”¥æ€³€¸”#N3ÖNÈN3%‚‚˜Ï`»
```
[Try it online!](https://tio.run/##MzBNTDJM/f/f7VHD3ENLDy971LTm0GYQsQMooOxnfHia3@EOP2PVRw2zgOj0nMP9CYd2//9vaAAA "05AB1E (legacy) – Try It Online")
**Explanation**
```
F                          # for N in [0 ... input] do:
 ”¥æ€³€¸”#                 # push ['Yeah', 'But', 'No']
          N3Ö              # push N % 3 == 0
             NÈ            # push N % 2 == 0
               N3%         # push N % 3
                  ‚‚˜      # add the 3 numbers to a list
                     Ï     # keep only the strings whose corresponding value  
                           # in the int list is true (1)
                      `»   # push strings separately to stack and join stack on newlines
```
[Answer]
# [Python 2](https://docs.python.org/2/), 73 bytes
```
lambda n:'\n'.join((["Yeah\nBut","No","But","Yeah","But\nNo"]*n)[:n-n/6])
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPSj0mT10vKz8zT0MjWikyNTEjJs@ptERJR8kvH0hAmCBhCCcmDygcq5WnGW2Vp5unbxar@b@gKDOvRCFNw0zzPwA "Python 2 – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~97~~ ~~95~~ ~~92~~ ~~90~~ ~~83~~ 81 bytes
```
lambda n:[w for i in range(n)for w in'Yeah','But','No'if('N'in w)==i%(3-(w<'N'))]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPKrpcIS2/SCFTITNPoSgxLz1VI08TJFAOFFCPTE3MUNdRdyotAZJ@@eqZaRrqfupAleWatraZqhrGuhrlNkARTc3Y/wVFmXklCmkahgaa/wE "Python 2 – Try It Online")
-2 bytes, thanks to ovs
---
# [Python 3](https://docs.python.org/3/), ~~92~~ ~~90~~ ~~85~~ 83 bytes
```
lambda n:[w for i in range(n)for w in['Yeah','But','No']if('N'in w)==i%(3-(w<'N'))]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPKrpcIS2/SCFTITNPoSgxLz1VI08TJFAOFIhWj0xNzFDXUXcqLQGSfvnqsZlpGup@6kC15Zq2tpmqGsa6GuU2QBFNzdj/BUWZeSUaaRqGBpqa/wE "Python 3 – Try It Online")
-4 bytes, thanks to ovs
-4 bytes, thanks to Jo King
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), 27 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
｛╷⌐３％‽YeahＰ｝２％‽ButＰ｝３％╷‽NoＰ
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JXVGRjVCJXUyNTc3JXUyMzEwJXVGRjEzJXVGRjA1JXUyMDNEWWVhaCV1RkYzMCV1RkY1RCV1RkYxMiV1RkYwNSV1MjAzREJ1dCV1RkYzMCV1RkY1RCV1RkYxMyV1RkYwNSV1MjU3NyV1MjAzRE5vJXVGRjMw,i=MTA_,v=8)
[Answer]
# [Groovy](http://groovy-lang.org/) (function), 79 bytes
Since initially submitting my answer, I've looked through some historic discussions here about what constitutes a suitable answer. Since it seems commonly accepted to provide just a method in Java (including return type and parameter declarations), here is a shorter, Groovy, method which has the method return value be the answer. Use of `def` means that the return type is inferred.
```
def a(int n){n?a(--n)+(n%3?'':'Yeah\n')+(n%2?'':'But\n')+(n%3==1?'No\n':''):''}
```
Unlike the original answer below, which loops from 0 up to n-1, this one calls itself from n down to 1, but decrements the input for the rest of the line in the recursive call.
[Try it online!](https://tio.run/##Sy/Kzy@r/P8/JTVNIVEjM69EIU@zOs8@UUNXN09TWyNP1dheXd1KPTI1MSMmTx0sYgQWcSotgQkY29oa2qv75QP5VurqmkBcCzavJLW4RCNPU6GaSwEICoqApufkKSip5FkpIUSAtuZpoiqwBQElrlouLrAJBpoQ2hBKG8H4QImi1JLSorz/AA "Groovy – Try It Online")
# [Groovy](http://groovy-lang.org/) (program), 87 bytes
Groovy scripts don't require certain common imports, so this can be a program printing the answer to Java's STDOUT without having to declare `System.out.` before `print`. It also provides some common utility methods, such as this `toLong()` which allows us to parse the input argument reasonably consicely.
Essentially the Java 10 answer, but leveraging Groovy's shorter loop syntax and ability to evaluate truthy statements.
```
args[0].toLong().times{print((it%3?'':'Yeah\n')+(it%2?'':'But\n')+(it%3==1?'No\n':''))}
```
[Try it online!](https://tio.run/##Sy/Kzy@r/P8/sSi9ONogVq8k3yc/L11DU68kMze1uLqgKDOvREMjs0TV2F5d3Uo9MjUxIyZPXVMbJGQEFnIqLYGLGNvaGtqr@@UDBazU1TU1a////29oAAA "Groovy – Try It Online")
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 45 bytes
```
.+
$*
1
$`Yeah¶$`But¶$`11No¶
+`11B
B
111
A`1
```
[Try it online!](https://tio.run/##K0otycxL/P9fT5tLRYvLkEslITI1MePQNpUEp9ISEGVo6Jd/aBuXNpDhxOXEZWhoyMXlmGD4/7@hAQA "Retina 0.8.2 – Try It Online") Explanation:
```
.+
$*
```
Convert the input to unary.
```
1
$`Yeah¶$`But¶$`11No¶
```
For each integer `0...n-1`, generate three lines of text, one for each word, each with `i` `1`s before it, except for `No`, which has two extra `1`s so that we calculate `(i+2)%3==0` which is equivalent to `i%3==1`.
```
+`11B
B
```
Remove pairs of `1`s before `B`s.
```
111
```
Remove `1`s in groups of three everywhere else.
```
A`1
```
Delete all lines that still have a `1`.
[Answer]
# Java 10, ~~100~~ 99 bytes
```
n->{for(int i=0;i<n;)System.out.print((i%3<1?"Yeah\n":"")+(i%2<1?"But\n":"")+(++i%3>1?"No\n":""));}
```
-1 byte thanks to *@OlivierGrégoire*.
[Try it online.](https://tio.run/##bY/NbsIwEITvPMUqUiVbEVGAGwYq9d5cOFVtD8aY1jRsoniDVKE8e7oxFuKnF0vzzXpndq@Perzf/vSm1N7Dq3Z4GgE4JNvstLFQDBLgWLktGMEcUCpG3YgfT5qcgQIQltDjeHXaVU0YcstcuQUquf71ZA9Z1VJWN@wI4Z5mi8lz8mb19wcm8ySRKbPpwF5auqA05cEVw6KKTKquV0Ns3W5Kjo3podqBi4s1ccLX@ydoeW5N1pPIQ98oJtdieuPkD3eFzcEMJ2HdUlx8f1WJItgpF41LMTNnFvU/X2Jg1/8B)
**Explanation:**
```
n->{                   // Method with integer parameter and no return-type
  for(int i=0;i<n;)    //  Loop `i` in the range [0, `n`)
    System.out.print(  //   Print to STDOUT:
      (i%3<1?          //    If `i` is divisible by 3:
        "Yeah\n"       //     Print "Yeah" with newline
      :"")+(i%2<1?     //    If `i` is even:
        "But\n"        //     Print "But" with newline
      :"")+(++i%3>1?   //    If `i` modulo-3 is 1:
        "No\n"         //     Print "No" with newline
      :                //    If none of the above three if's applied to the current `i`:
       ""));}          //     Print nothing for the current `i`
```
[Answer]
# Powershell, ~~75~~ ~~74~~ ~~72~~ ~~67~~ 66 bytes
*-1 byte thanks [TessellatingHeckler](https://codegolf.stackexchange.com/users/571/tessellatingheckler)*
```
param($n)(" Yeah
But No But Yeah But
No "*$n-split' ')[1..$n]-ne''
```
Test script and explanation:
```
$f = {
param($n)(" Yeah
But No But Yeah But
No "*$n-split' ')[1..$n]-ne''
# 1. repeat the string $n times
# 2. split by space
# 3. get elements from 1 to $n
# some elements are multiline strings, some elements are $null:
# ($null,"Yeah`nBut","But","No","But","Yeah","But`nNo",$null,...)
# 4. remove $null elements from result array
}
# Output results
@(
    0,1,2,10
) | % {
    &$f $_
    "======"
}
# Advanced test
@(
    ,(0,'')
    ,(1,'Yeah But')
    ,(2,'Yeah But No')
    ,(3,'Yeah But No But')
    ,(4,'Yeah But No But Yeah')
    ,(5,'Yeah But No But Yeah But No')
    ,(6,'Yeah But No But Yeah But No')
    ,(7,'Yeah But No But Yeah But No Yeah But')
    ,(8,'Yeah But No But Yeah But No Yeah But No')
    ,(9,'Yeah But No But Yeah But No Yeah But No But')
    ,(10,'Yeah But No But Yeah But No Yeah But No But Yeah')
    ,(20,'Yeah But No But Yeah But No Yeah But No But Yeah But No Yeah But No But Yeah But No Yeah But No')
) | % {
    $n,$e = $_
    $r = &$f $n
    $r = $r-split"`n"       # simplify test string
    "$($e-eq$r): $n : $r"
}
```
Output:
```
======
Yeah
But
======
Yeah
But
No
======
Yeah
But
No
But
Yeah
But
No
Yeah
But
No
But
Yeah
======
True: 0 :
True: 1 : Yeah But
True: 2 : Yeah But No
True: 3 : Yeah But No But
True: 4 : Yeah But No But Yeah
True: 5 : Yeah But No But Yeah But No
True: 6 : Yeah But No But Yeah But No
True: 7 : Yeah But No But Yeah But No Yeah But
True: 8 : Yeah But No But Yeah But No Yeah But No
True: 9 : Yeah But No But Yeah But No Yeah But No But
True: 10 : Yeah But No But Yeah But No Yeah But No But Yeah
True: 20 : Yeah But No But Yeah But No Yeah But No But Yeah But No Yeah But No But Yeah But No Yeah But No
```
Straightforward script, 72 bytes:
```
$args|?{$_}|%{0..--$_|%{@('Yeah')[$_%3]
@('But')[$_%2]
@{1='No'}[$_%3]}}
```
[Answer]
# [Haskell](https://www.haskell.org/), 71 bytes
```
f n=[1..n]>>=(3?1)"Yeah"<>(2?1)"But"<>(3?2)"No"
(a?b)c n=[c|n`mod`a==b]
```
[Try it online!](https://tio.run/##JYwxa8MwFIR3/4pDdJAgiNjZimVDmqXQtEOnkpjmxVZiE/vJ2DJd@t9diS7H3cfdtTQ/bN@v3TC6yeNAnvTRsesaSMi8UFDrDWxOqdZcFYWRuzJV4stSK/JCZjHsFx/9rsyUeHcikVReVR1H9S9fBtdcyJhrtQ7UMQwGGo/fkOPiP/30xtC4OxW079jOMHmOu/Uvjr1lP@OntZNNEDqY47p2XJPHSbxyeHiG2AS@gTjzx@IjOXNAC/@/adzwhMlSE1rVuk3SJEvS7R8 "Haskell – Try It Online")
### Explanation
Pretty simple, saved two bytes by using `[1..n]` instead of `[0..n-1]` and adjusted the remainders: The operator `(?)` tests takes four arguments, returning an empty list or the provided string as a singleton if the result is correct.
By currying the fourth argument of `(?)` we can make use of `(<>)` to concatenate the results of each function, ie.:
```
(3?1)"Yeah" <> (2?1)"But" <> (3?2)"No" ≡ \i-> (3?1)"Yeah" i ++ (2?1)"But" i ++ (3?2)"No" i
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), ~~105~~ ~~99~~ ~~94~~ ~~96~~ 89bytes
```
i=>{for(int x=0;x<i;)Write((x%3<1?"Yeah\n":"")+(x%2<1?"But\n":"")+(x++%3==1?"No\n":""));}
```
[Try it online!](https://tio.run/##Sy7WTS7O/O@YXJKZn2fjmVdibGSnkKhg@z/T1q46Lb9IIzOvRKHC1sC6wibTWjO8KLMkVUOjQtXYxtBeKTI1MSMmT8lKSUlTGyhmBBJzKi1BCGlrqxrb2gJF/fKhgprWtf@tubjA5vhk5qVqqCgZWClpWiskahgASYS4pjWKIkOoIkN8ioygiozwmgSzzxDdwv8A "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [Pip](https://github.com/dloscutoff/pip), ~~37~~ ~~35~~ 33 bytes
```
"But 
Yeah
No
"<>5@:^[t2io02x]@<a
```
(Note the space after `But`.) Takes input as a command-line argument. [Try it online!](https://tio.run/##K8gs@P9fyam0RIErMjUxg8svn0vJxs7UwSouusQoM9/AqCLWwSbx////hgYA "Pip – Try It Online")
### Explanation
*This explanation is for the previous version--see below for changelog*
Inspired by [Jo King's Perl 6 answer](https://codegolf.stackexchange.com/a/172045/16766). We construct this list:
```
[
 "Yeah
 But
 ";
 "No
 ";
 "But
 ";
 "Yeah
 ";
 "But
 No
 ";
 ""
]
```
and output the first `a` elements of it using cyclic indexing.
```
[t2io02x]R,3["But""Yeah""No"].n@<:a
                                     i is 0; o is 1; t is 10; x is ""; n is newline;
                                     a is 1st cmdline arg (implicit)
[       ]                            Construct this list of scalars:
 t                                    10
  2                                   2
   i                                  0
    o                                 1
     02                               02
       x                              <empty string>
         R                           Treating each of these as a string, we're going to
                                     replace:
          ,3                          0, 1, and 2 (respectively)
                                     with the corresponding values from this list:
            ["But""Yeah""No"].n       These strings, each with a newline appended
                                     We now have constructed the list shown above
                               @<:a  Take the first a elements from this list, with
                                     cyclical indexing (the : is for parsing reasons)
                                     Concatenate them together and print (implicit)
```
**Update:** I realized that I don't need to use replace to change 0/1/2 into strings--I can use those numbers to index into a list directly. To do this, we have to make sure the multi-digit numbers are split into lists of their digits (otherwise, we'll be selecting index 10 instead of indexes 1 and 0). Fortunately, using an arbitrarily nested list as an index in Pip works as expected, giving a (nested) list of results. For input of 3, we get this data progression (where `_` represents a newline):
```
"But _Yeah_No_"<>5                       ["But _"; "Yeah_"; "No_"]
                     [t2io02x]           [10; 2; 0; 1; 02; ""]
                              @<a        [10; 2; 0]
                    ^                    [[1; 0]; [2]; [0]]
                  @:                     [["Yeah_"; "But _"]; ["No_"]; ["But _"]]
```
As before, the final result is concatenated together and autoprinted.
[Answer]
# [Attache](https://github.com/ConorOBrien-Foxx/Attache), 48 bytes
```
Flat##{Mask[_%3'2'3=0'0'1,$Yeah'$But'$No]}=>Iota
```
[Try it online!](https://tio.run/##SywpSUzOSP2fpmBl@98tJ7FEWbnaN7E4Ozpe1VjdSN3Y1kDdQN1QRyUyNTFDXcWptERdxS8/ttbWzjO/JPG/X2pqSnG0SkFBcnosV0BRZl5JSGpxiXNicWpxdJqOgoGVkbqRQex/AA "Attache – Try It Online")
## Explanation
```
Flat##{Mask[_%3'2'3=0'0'1,$Yeah'$But'$No]}=>Iota   input: an integer
      {                                  }=>Iota   over each number from 0 to that integer exclusive
       Mask[             ,$Yeah'$But'$No]          select values from that array according to:
            _%3'2'3                                    whether or not the input mod 3, 2, 3
                   =0'0'1                              is 0, 0, 1
Flat##                                             flatten the intermediate results
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~77~~ ~~71~~ ~~74~~ ~~72~~ 69 bytes
There's already a better **C** answer here but this one is recursive and it took me some time to get straight so I'm posting it.
Down to 69 bytes thanks to both @ceilingcat and @JonathanFrech
(I never think to use n-~-i in place of n-i+1)
```
i;f(n){i=n&&n-i>=~n/6&&f(n,i++,puts(i%7%4?i%7%2?"But":"No":"Yeah"));}
```
[Try it online!](https://tio.run/##LYpRC4IwFEbf/RVj4NhlG2VEQcuEfkDvgS9irS6jq5g@if31Na3zcPg4fLV51HUIaJ0kGDEnIcjgKf/QaidEjBqV0u3QvyWm@3RbzN4U/Dz0/MAvTdT1Xj05gJ3Cq0KSkIwJiyD1zNtluqZj0udr649ZZr1SsOSZtos/J3lJ5kd6@w9TEtcetJMebDKFLw "C (gcc) – Try It Online")
[Answer]
# Ruby, 69 ~~72~~ ~~74~~ Bytes
```
->y{puts *(1..y).map{|i|[i%3==1&&:Yeah,i%2>0&&:But,i%3>1&&:No]-[!0]}}
```
Very straight-forward answer, checking for a shorter, recursive method right now.
Saved two bytes thanks to @BWO :)
Saved another three bytes by using symbols instead of strings
[Answer]
# Python 3, 93 bytes
```
[print("Yeah\n"*(i%3<1)+"But\n"*(i%2<1)+"No\n"*(i%3==1),end="")for i in range(int(input()))]
```
This isn't exactly the best solution but it's my take on it.
[Try it online!](https://tio.run/##K6gsycjPM/7/P7qgKDOvREMpMjUxIyZPSUsjU9XYxlBTW8mptATKNwLz/fJh0ra2hpo6qXkptkpKmmn5RQqZCpl5CkWJeempGiCjMvMKSks0NDU1Y///NzQAAA)
[Answer]
## R, 65 bytes
```
cat(c("yeah","but","no")[c(3,1:3,2,1,2)][1:scan()%%7+1],sep="\n")
```
Due to the fact that we are replicating a slightly flawed program (it misses out every fourth "but" — it should have used `%4 == 1` and `%4 == 3` rather than `%3` conditions), we have to use an awkward call to `c` and work in base seven. Still, it's shorter than LOLCODE...
(I was hoping that (3,1,2,3,2,1,2) or a similar permutation might appear in the `lh` dataset somewhere but it doesn't look like it)
[Answer]
# [sed -E](http://www.grymoire.com/Unix/Sed.html), ~~179~~ 150 bytes
```
/^0/!s:$:g:
:l;y:abcdefg:bcdefga:
/[ae]/iYeah
/[bdf]/iBut
/[cg]/iNo
s:.$:-&:;:s;s:0-:-9:;ts;h
y:123456789:012345678:;G
s:.*(.)-.*\n(.*).-:\2\1:;tl;c\ 
```
The hardest part was not to construct the list but to actually parse the decimal number.
2 bytes may be saved if the newline at the end is not required: `c\` → `d`.
Still requires optimization.
[Try it online](https://tio.run/##NcvLCoJAAIXh/TxFgYQKc1G7eWYXRLv2kQWjjqMgGowufPmmiWh1vrP4ra6pGWbn@FPwtUUAA4JeLlBlVevG4DcKhN@VfvDuplXrXdaNP6d58q6M53UkFiwA3UDCSgtBQXPIycqWLEjSbLvbH445xJ@Ql28ShyyiLC6GkMURoyjSIvFZL6ti5ZwgKUkzkoj3@Jq6cbCOnj8).
### Explanation
```
/^0/!                            | if the input number doesn`t begin with a '0'…
     s:$:g:                      | …then append a 'g' to it and proceed
                                 |
:l;                              | loop label 'l':
   y:abcdefg:bcdefga:            | shift all occurences of [abcdef] 1 letter forward, and all 'g'-s to 'a'-s
                                 |
/[ae]/                           | if there`s an 'a' or 'e' in the input…
      iYeah                      | …output 'Yeah'
                                 |
/[bdf]/                          | if there`s a 'b' or 'd' or 'f' in the input…
       iBut                      | …output 'But'
                                 |
/[cg]/                           | if there`s a 'c' or 'g' in the input…
      iNo                        | …output 'No' 
                                 |
s:.$:-&:;                        | insert '-' before the last character
         :s;                     | loop label 's':
            s:0-:-9:;            | transform the next consecutive '0' in the end of the number to '9', if any
                     ts;         | loop to 's' if more consecutive zeroes are available
                        h        | copy the result to the temporary buffer
                                 |
y:123456789:012345678:;          | decrement all digits except '0' (N.B.: digits, not numbers)
                       G         | append the temporary buffer to the result
                                 |
s:.*(.)-.*\n(.*).-:\2\1:;        | cut and replace the digit left to the last consecutive 0 in the original
                                 | number pasted from the temporary buffer, then discard all other digits decremented
                         tl;     | …then loop to 'l' if the number is ≥0
                            c\   | insert a carriage return and exit
```
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), 116 bytes
```
import StdEnv,Data.List
r=cycle
$n=[e\\_<-[1..n]&a<-r["Yeah","",""]&b<-r["But",""]&c<-r["","No",""],e<-[a,b,c]|e>""]
```
[Try it online!](https://tio.run/##JY3LCoMwFET3fkUQcRWl7rWLYhcFKQVXRaVcr9EG8igxFoR@e9NUYRZzDgyDgoFyUg@LYEQCV47LlzaW1HY4qzctwUJa8dkGpsAVBQsiVTSsbR950mRpqroY8sQ04Z3BM6ThP13cb@q02B1xQ9@vehOU@THQnmL3YUcvXG3BfxYkItnBfXEUMM0uuVSuXBVIjjvcBNhRG/kD "Clean – Try It Online")
[Answer]
## F#, 108 106 bytes
```
let v p=seq{for i=1 to p do
 if i%3=1 then yield"Yeah"
 if i%2=1 then yield"But"
 if i%3=2 then yield"No"}
```
[Try it online!](https://tio.run/##VY1BC4IwGIbv/oqXgVAHRe3aPARdI@gU4kF0q5FtOudAqt@@1CTqOz7P@/DxLiiVZs7VzMCioR1rH1xpCBrDKDSolAfBIfzNRK5MYhCsrsiZFVeyqORf7XpDvlHyaw6KvFy23Uujh6MS0qS5N32@F0Ki0BcL6mG8iZWqlwYU42pWYRbls7SLeqY4sTYUhmmseC9hRXkbEKRo9BhxCeJ35EPXcxk5F0dv)
-2 bytes changing from `i=0 to p-1` to `i=1 to p` and adjusting modulos. Apart from that, pretty straight-forward.
[Answer]
# PHP, ~~65~~ 68 bytes
```
while($i<$argn)echo["Yeah
"][$i%3],["But
"][$i%2],["No
"][~-$i++%3];
```
Run as pipe with `-nR` or [try it online](http://sandbox.onlinephpfunctions.com/code/b65c92164b9e7d65fe21d983f1e9b11d6a497fae).
[Answer]
# VBA (Excel), ~~105, 101,~~ 99 Bytes
Edit: -4 bytes from Keeta! Thanks!
Edit 2: -2 bytes from Chronocidal! Woot! (Realized that test cases only worked for 10. Fixed now)
**Yeah, Excel beat VBA this time. Whatever.** (We're coming for you)
```
d=vbCr:For i=1To[a1]:a=i Mod 3:?IIf(a=1,"Yeah"+d,"")IIf(i/2=i\2,"","But"+d)IIf(a=2,"No"+d,"");:Next
```
^This is pasted into the Immediate window and outputs to the debug window
Ungolfed
```
d = vbCr
'For 1 to the value in A1 (using 0 gave extra values, and VBA skips the for loop if 0)
For i = 1 To [a1]    'aka: Range("A1").value
    a = i mod 3
    '? is the same as Print (Debug.Print when not in the Immediate Window)
    Print IIf(a = 1, "Yeah" + d, "") _ '<-- Just a line continuation
          'Keeta taught me that the \ operator is division with truncation,
          '     so if they are equal then there is no remainder!
          IIf(i / 2 = i \ 2, "", "But" + d) _
          IIf(a = 2, "No" + d, "");
    'Print usually prints a newline, but it still outputs if the string is blank...
    '   So we append a newline -if true- and use a semi-colon to kill the newline
Next
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 22 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
5Rż7FṚṁị“'⁴\ÆẓNƇ»ḲŒP¤Ẏ
```
A monadic Link yielding a list of lines (which seems to have been allowed in comments)
**[Try it online!](https://tio.run/##ATsAxP9qZWxsef//NVLFvDdG4bma4bmB4buL4oCcJ@KBtFzDhuG6k07Gh8K74biyxZJQwqThuo7/w4dZ//8xMA "Jelly – Try It Online")** (the footer calls the Link using `Ç` and joins with newlines using `Y` since implicit printing in Jelly smashes everything together if it can)
### How?
First note that we have a period of \$2\times3=6\$ due to the modulo definition.
Now note that the first six values are:
```
["Yeah", "But"]
["No"]
["But"]
["Yeah"]
["But", "No"]
[]
```
So the resulting list of lines should be these values repeated (or truncated) to length `n` concatenated together.
Now note that the power-set of `"Yeah", "But", "No"` is:
```
[]
["Yeah"]
["But"]
["No"]
["Yeah", "But"]
["Yeah", "No"]
["But", "No"]
["Yeah", "But", "No"]
```
So each period is these 1-indexed values of the power-set of `"Yeah", "But", "No"`:
```
5, 4, 3, 2, 7, 1
```
The code makes this list, moulds it to length `n`, indexes into the power-set, and then removes the inner lists (which also removes the empty strings, since strings are lists in Jelly)...
```
5Rż7FṚṁị“'⁴\ÆẓNƇ»ḲŒP¤Ẏ - Link: integer, n   e.g. 10
5                      - literal five            5
 R                     - range                   [1,2,3,4,5]
   7                   - literal seven           7
  ż                    - zip together            [[1,7],[2],[3],[4],[5]]
    F                  - flatten                 [1,7,2,3,4,5]
     Ṛ                 - reverse                 [5,4,3,2,7,1]
      ṁ                - mould like (n)          [5,4,3,2,7,1,5,4,3,2]
                    ¤  - nilad followed by link(s) as a nilad:
        “'⁴\ÆẓNƇ»      -   compressed string     "Yeah But No"
                 Ḳ     -   split at spaces       ["Yeah","But","No"]
                  ŒP   -   power-set             [[],["Yeah"],["But"],["No"],["Yeah","But"],["Yeah","No"],["But","No"],["Yeah","But","No"]]
       ị               - index into              [["Yeah","But"],["No"],["But"],["Yeah"],["But","No"],[],["Yeah","But"],["No"],["But"],["Yeah"]]
                     Ẏ - tighten                 ["Yeah","But","No","But","Yeah","But","No","Yeah","But","No","But","Yeah"]
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~93~~ ~~92~~ 83 bytes
```
lambda i:''.join('Yeah\n'*(x%3<1)+'But\n'*(x%2<1)+'No\n'*(x%3==1)for x in range(i))
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHTSl1dLys/M09DPTI1MSMmT11Lo0LV2MZQU1vdqbQEyjcC8/3yYdK2toaaaflFChUKmXkKRYl56akamZqa/wuKMvNKFJQ88wpKSxQMY/KUuCAiaRqGmlwokkbIkkZokoYGKFoNNP8DAA "Python 2 – Try It Online")
A massive 9 bytes saved with thanks to @Jonathan Frech
]