Fedora 28: Generate kerberos ticket on login

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

up vote
3
down vote

favorite

I’m trying to generate kerberos ticket when I login on my computer(Fedora 28). I want to achieve it using PAM. my /etc/pam.d/system-auth looks like this:

auth        required                                     pam_env.so
auth        required                                     pam_faildelay.so delay=2000000
auth        [default=1 ignore=ignore success=ok]         pam_succeed_if.so uid >= 1000 quiet
auth        [default=1 ignore=ignore success=ok]         pam_localuser.so
auth        sufficient                                   pam_unix.so nullok try_first_pass
auth        requisite                                    pam_succeed_if.so uid >= 1000 quiet_success
#auth        sufficient                                   pam_sss.so forward_pass
auth        sufficient                                   pam_krb5.so try_first_pass
auth        required                                     pam_deny.so

account     required                                     pam_unix.so
account     sufficient                                   pam_localuser.so
account     sufficient                                   pam_succeed_if.so uid < 1000 quiet
#account     [default=bad success=ok user_unknown=ignore] pam_sss.so
account     [default=bad success=ok user_unknown=ignore] pam_krb5.so
account     required                                     pam_permit.so

password    requisite                                    pam_pwquality.so try_first_pass local_users_only
password    sufficient                                   pam_unix.so sha512 shadow nullok try_first_pass use_authtok
#password    sufficient                                   pam_sss.so use_authtok
password    sufficient                                   pam_krb5.so use_authtok
password    required                                     pam_deny.so

session     optional                                     pam_keyinit.so revoke
session     required                                     pam_limits.so
-session    optional                                     pam_systemd.so
session     [success=1 default=ignore]                   pam_succeed_if.so service in crond quiet use_uid
session     required                                     pam_unix.so
#session     optional                                     pam_sss.so
session     optional                                     pam_krb5.so

and here are the logs from /var/log/secure:

Sep 12 12:48:04 vbox sudo[1408]:    vbox : problem with defaults entries ; TTY=tty1 ; PWD=/etc ; USER=root ;
Sep 12 12:48:05 vbox sudo[1408]:    vbox : TTY=tty1 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chown root:root krb5.keytab
Sep 12 12:48:05 vbox sudo[1408]: pam_systemd(sudo:session): Cannot create session: Already running in a session
Sep 12 12:48:05 vbox sudo[1408]: pam_unix(sudo:session): session opened for user root by vbox(uid=0)
Sep 12 12:48:05 vbox sudo[1408]: pam_unix(sudo:session): session closed for user root
Sep 12 12:48:07 vbox sudo[1413]:    vbox : problem with defaults entries ; TTY=tty1 ; PWD=/etc ; USER=root ;
Sep 12 12:48:07 vbox sudo[1413]:    vbox : TTY=tty1 ; PWD=/etc ; USER=root ; COMMAND=/usr/sbin/reboot
Sep 12 12:48:07 vbox sudo[1413]: pam_systemd(sudo:session): Cannot create session: Already running in a session
Sep 12 12:48:07 vbox sudo[1413]: pam_unix(sudo:session): session opened for user root by vbox(uid=0)
Sep 12 12:48:07 vbox login[746]: pam_unix(login:session): session closed for user vbox
Sep 12 12:48:07 vbox login[746]: pam_krb5[746]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:48:07 vbox login[746]: pam_krb5[746]: error initializing Kerberos
Sep 12 12:48:07 vbox sudo[1413]: pam_unix(sudo:session): session closed for user root
Sep 12 12:48:07 vbox systemd[1092]: pam_unix(systemd-user:session): session closed for user vbox
Sep 12 12:48:07 vbox systemd[1092]: pam_krb5[1092]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:48:07 vbox systemd[1092]: pam_krb5[1092]: error initializing Kerberos
Sep 12 12:48:13 vbox sshd[739]: Received signal 15; terminating.
Sep 12 12:48:43 vbox sshd[728]: Server listening on 0.0.0.0 port 22.
Sep 12 12:48:43 vbox sshd[728]: Server listening on :: port 22.
Sep 12 12:48:46 vbox polkitd[766]: Loading rules from directory /etc/polkit-1/rules.d
Sep 12 12:48:46 vbox polkitd[766]: Loading rules from directory /usr/share/polkit-1/rules.d
Sep 12 12:48:47 vbox polkitd[766]: Finished loading, compiling and executing 13 rules
Sep 12 12:48:47 vbox polkitd[766]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
Sep 12 12:49:11 vbox systemd[1093]: pam_unix(systemd-user:session): session opened for user vbox by (uid=0)
Sep 12 12:49:11 vbox systemd[1093]: pam_krb5[1093]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:49:11 vbox systemd[1093]: pam_krb5[1093]: error initializing Kerberos
Sep 12 12:49:12 vbox login[745]: pam_unix(login:session): session opened for user vbox by LOGIN(uid=0)
Sep 12 12:49:12 vbox login[745]: pam_krb5[745]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:49:12 vbox login[745]: pam_krb5[745]: error initializing Kerberos
Sep 12 12:49:12 vbox login[745]: LOGIN ON tty1 BY vbox
Sep 12 12:57:20 vbox sshd[1200]: Accepted password for vbox from 192.168.1.53 port 54824 ssh2
Sep 12 12:57:20 vbox sshd[1200]: pam_unix(sshd:session): session opened for user vbox by (uid=0)
Sep 12 12:58:26 vbox sudo[1255]:    vbox : problem with defaults entries ; TTY=pts/0 ; PWD=/etc/pam.d ; USER=root ;

As you can see I have pam_krb5[745]: error initializing kerberos: 13 (Permission denied). I’ve searched and found that the problem could be the permissions of krb5.conf, I’ve set it to 644:

-rw-r--r--. 1 root root 3.8K Jul 31 13:29 krb5.conf

but I have same error. I’ve also noticed that if I login and manually type kinit vbox I’m able to get the ticket. I can’t understand why I have Permission Denied error.

P.S
Here is the content of krb5.conf. https://pastebin.com/t7T2CsBH

share|improve this question

  • Please add the contents of your krb5.conf
    – Rui F Ribeiro
    Sep 12 at 9:41

  • pastebin.com/t7T2CsBH thank you for your response 🙂
    – user3503143
    Sep 12 at 9:50

  • You should have your domain in there for tickets to work, I think. At least that what I used to do. I usually only had a few lines in that file. From the top of my head, I also think that file does not like comments, or at least not comments on the configuration lines.
    – Rui F Ribeiro
    Sep 12 at 9:56

up vote
3
down vote

favorite

I’m trying to generate kerberos ticket when I login on my computer(Fedora 28). I want to achieve it using PAM. my /etc/pam.d/system-auth looks like this:

auth        required                                     pam_env.so
auth        required                                     pam_faildelay.so delay=2000000
auth        [default=1 ignore=ignore success=ok]         pam_succeed_if.so uid >= 1000 quiet
auth        [default=1 ignore=ignore success=ok]         pam_localuser.so
auth        sufficient                                   pam_unix.so nullok try_first_pass
auth        requisite                                    pam_succeed_if.so uid >= 1000 quiet_success
#auth        sufficient                                   pam_sss.so forward_pass
auth        sufficient                                   pam_krb5.so try_first_pass
auth        required                                     pam_deny.so

account     required                                     pam_unix.so
account     sufficient                                   pam_localuser.so
account     sufficient                                   pam_succeed_if.so uid < 1000 quiet
#account     [default=bad success=ok user_unknown=ignore] pam_sss.so
account     [default=bad success=ok user_unknown=ignore] pam_krb5.so
account     required                                     pam_permit.so

password    requisite                                    pam_pwquality.so try_first_pass local_users_only
password    sufficient                                   pam_unix.so sha512 shadow nullok try_first_pass use_authtok
#password    sufficient                                   pam_sss.so use_authtok
password    sufficient                                   pam_krb5.so use_authtok
password    required                                     pam_deny.so

session     optional                                     pam_keyinit.so revoke
session     required                                     pam_limits.so
-session    optional                                     pam_systemd.so
session     [success=1 default=ignore]                   pam_succeed_if.so service in crond quiet use_uid
session     required                                     pam_unix.so
#session     optional                                     pam_sss.so
session     optional                                     pam_krb5.so

and here are the logs from /var/log/secure:

Sep 12 12:48:04 vbox sudo[1408]:    vbox : problem with defaults entries ; TTY=tty1 ; PWD=/etc ; USER=root ;
Sep 12 12:48:05 vbox sudo[1408]:    vbox : TTY=tty1 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chown root:root krb5.keytab
Sep 12 12:48:05 vbox sudo[1408]: pam_systemd(sudo:session): Cannot create session: Already running in a session
Sep 12 12:48:05 vbox sudo[1408]: pam_unix(sudo:session): session opened for user root by vbox(uid=0)
Sep 12 12:48:05 vbox sudo[1408]: pam_unix(sudo:session): session closed for user root
Sep 12 12:48:07 vbox sudo[1413]:    vbox : problem with defaults entries ; TTY=tty1 ; PWD=/etc ; USER=root ;
Sep 12 12:48:07 vbox sudo[1413]:    vbox : TTY=tty1 ; PWD=/etc ; USER=root ; COMMAND=/usr/sbin/reboot
Sep 12 12:48:07 vbox sudo[1413]: pam_systemd(sudo:session): Cannot create session: Already running in a session
Sep 12 12:48:07 vbox sudo[1413]: pam_unix(sudo:session): session opened for user root by vbox(uid=0)
Sep 12 12:48:07 vbox login[746]: pam_unix(login:session): session closed for user vbox
Sep 12 12:48:07 vbox login[746]: pam_krb5[746]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:48:07 vbox login[746]: pam_krb5[746]: error initializing Kerberos
Sep 12 12:48:07 vbox sudo[1413]: pam_unix(sudo:session): session closed for user root
Sep 12 12:48:07 vbox systemd[1092]: pam_unix(systemd-user:session): session closed for user vbox
Sep 12 12:48:07 vbox systemd[1092]: pam_krb5[1092]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:48:07 vbox systemd[1092]: pam_krb5[1092]: error initializing Kerberos
Sep 12 12:48:13 vbox sshd[739]: Received signal 15; terminating.
Sep 12 12:48:43 vbox sshd[728]: Server listening on 0.0.0.0 port 22.
Sep 12 12:48:43 vbox sshd[728]: Server listening on :: port 22.
Sep 12 12:48:46 vbox polkitd[766]: Loading rules from directory /etc/polkit-1/rules.d
Sep 12 12:48:46 vbox polkitd[766]: Loading rules from directory /usr/share/polkit-1/rules.d
Sep 12 12:48:47 vbox polkitd[766]: Finished loading, compiling and executing 13 rules
Sep 12 12:48:47 vbox polkitd[766]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
Sep 12 12:49:11 vbox systemd[1093]: pam_unix(systemd-user:session): session opened for user vbox by (uid=0)
Sep 12 12:49:11 vbox systemd[1093]: pam_krb5[1093]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:49:11 vbox systemd[1093]: pam_krb5[1093]: error initializing Kerberos
Sep 12 12:49:12 vbox login[745]: pam_unix(login:session): session opened for user vbox by LOGIN(uid=0)
Sep 12 12:49:12 vbox login[745]: pam_krb5[745]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:49:12 vbox login[745]: pam_krb5[745]: error initializing Kerberos
Sep 12 12:49:12 vbox login[745]: LOGIN ON tty1 BY vbox
Sep 12 12:57:20 vbox sshd[1200]: Accepted password for vbox from 192.168.1.53 port 54824 ssh2
Sep 12 12:57:20 vbox sshd[1200]: pam_unix(sshd:session): session opened for user vbox by (uid=0)
Sep 12 12:58:26 vbox sudo[1255]:    vbox : problem with defaults entries ; TTY=pts/0 ; PWD=/etc/pam.d ; USER=root ;

As you can see I have pam_krb5[745]: error initializing kerberos: 13 (Permission denied). I’ve searched and found that the problem could be the permissions of krb5.conf, I’ve set it to 644:

-rw-r--r--. 1 root root 3.8K Jul 31 13:29 krb5.conf

but I have same error. I’ve also noticed that if I login and manually type kinit vbox I’m able to get the ticket. I can’t understand why I have Permission Denied error.

P.S
Here is the content of krb5.conf. https://pastebin.com/t7T2CsBH

share|improve this question

  • Please add the contents of your krb5.conf
    – Rui F Ribeiro
    Sep 12 at 9:41

  • pastebin.com/t7T2CsBH thank you for your response 🙂
    – user3503143
    Sep 12 at 9:50

  • You should have your domain in there for tickets to work, I think. At least that what I used to do. I usually only had a few lines in that file. From the top of my head, I also think that file does not like comments, or at least not comments on the configuration lines.
    – Rui F Ribeiro
    Sep 12 at 9:56

up vote
3
down vote

favorite

up vote
3
down vote

favorite

I’m trying to generate kerberos ticket when I login on my computer(Fedora 28). I want to achieve it using PAM. my /etc/pam.d/system-auth looks like this:

auth        required                                     pam_env.so
auth        required                                     pam_faildelay.so delay=2000000
auth        [default=1 ignore=ignore success=ok]         pam_succeed_if.so uid >= 1000 quiet
auth        [default=1 ignore=ignore success=ok]         pam_localuser.so
auth        sufficient                                   pam_unix.so nullok try_first_pass
auth        requisite                                    pam_succeed_if.so uid >= 1000 quiet_success
#auth        sufficient                                   pam_sss.so forward_pass
auth        sufficient                                   pam_krb5.so try_first_pass
auth        required                                     pam_deny.so

account     required                                     pam_unix.so
account     sufficient                                   pam_localuser.so
account     sufficient                                   pam_succeed_if.so uid < 1000 quiet
#account     [default=bad success=ok user_unknown=ignore] pam_sss.so
account     [default=bad success=ok user_unknown=ignore] pam_krb5.so
account     required                                     pam_permit.so

password    requisite                                    pam_pwquality.so try_first_pass local_users_only
password    sufficient                                   pam_unix.so sha512 shadow nullok try_first_pass use_authtok
#password    sufficient                                   pam_sss.so use_authtok
password    sufficient                                   pam_krb5.so use_authtok
password    required                                     pam_deny.so

session     optional                                     pam_keyinit.so revoke
session     required                                     pam_limits.so
-session    optional                                     pam_systemd.so
session     [success=1 default=ignore]                   pam_succeed_if.so service in crond quiet use_uid
session     required                                     pam_unix.so
#session     optional                                     pam_sss.so
session     optional                                     pam_krb5.so

and here are the logs from /var/log/secure:

Sep 12 12:48:04 vbox sudo[1408]:    vbox : problem with defaults entries ; TTY=tty1 ; PWD=/etc ; USER=root ;
Sep 12 12:48:05 vbox sudo[1408]:    vbox : TTY=tty1 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chown root:root krb5.keytab
Sep 12 12:48:05 vbox sudo[1408]: pam_systemd(sudo:session): Cannot create session: Already running in a session
Sep 12 12:48:05 vbox sudo[1408]: pam_unix(sudo:session): session opened for user root by vbox(uid=0)
Sep 12 12:48:05 vbox sudo[1408]: pam_unix(sudo:session): session closed for user root
Sep 12 12:48:07 vbox sudo[1413]:    vbox : problem with defaults entries ; TTY=tty1 ; PWD=/etc ; USER=root ;
Sep 12 12:48:07 vbox sudo[1413]:    vbox : TTY=tty1 ; PWD=/etc ; USER=root ; COMMAND=/usr/sbin/reboot
Sep 12 12:48:07 vbox sudo[1413]: pam_systemd(sudo:session): Cannot create session: Already running in a session
Sep 12 12:48:07 vbox sudo[1413]: pam_unix(sudo:session): session opened for user root by vbox(uid=0)
Sep 12 12:48:07 vbox login[746]: pam_unix(login:session): session closed for user vbox
Sep 12 12:48:07 vbox login[746]: pam_krb5[746]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:48:07 vbox login[746]: pam_krb5[746]: error initializing Kerberos
Sep 12 12:48:07 vbox sudo[1413]: pam_unix(sudo:session): session closed for user root
Sep 12 12:48:07 vbox systemd[1092]: pam_unix(systemd-user:session): session closed for user vbox
Sep 12 12:48:07 vbox systemd[1092]: pam_krb5[1092]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:48:07 vbox systemd[1092]: pam_krb5[1092]: error initializing Kerberos
Sep 12 12:48:13 vbox sshd[739]: Received signal 15; terminating.
Sep 12 12:48:43 vbox sshd[728]: Server listening on 0.0.0.0 port 22.
Sep 12 12:48:43 vbox sshd[728]: Server listening on :: port 22.
Sep 12 12:48:46 vbox polkitd[766]: Loading rules from directory /etc/polkit-1/rules.d
Sep 12 12:48:46 vbox polkitd[766]: Loading rules from directory /usr/share/polkit-1/rules.d
Sep 12 12:48:47 vbox polkitd[766]: Finished loading, compiling and executing 13 rules
Sep 12 12:48:47 vbox polkitd[766]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
Sep 12 12:49:11 vbox systemd[1093]: pam_unix(systemd-user:session): session opened for user vbox by (uid=0)
Sep 12 12:49:11 vbox systemd[1093]: pam_krb5[1093]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:49:11 vbox systemd[1093]: pam_krb5[1093]: error initializing Kerberos
Sep 12 12:49:12 vbox login[745]: pam_unix(login:session): session opened for user vbox by LOGIN(uid=0)
Sep 12 12:49:12 vbox login[745]: pam_krb5[745]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:49:12 vbox login[745]: pam_krb5[745]: error initializing Kerberos
Sep 12 12:49:12 vbox login[745]: LOGIN ON tty1 BY vbox
Sep 12 12:57:20 vbox sshd[1200]: Accepted password for vbox from 192.168.1.53 port 54824 ssh2
Sep 12 12:57:20 vbox sshd[1200]: pam_unix(sshd:session): session opened for user vbox by (uid=0)
Sep 12 12:58:26 vbox sudo[1255]:    vbox : problem with defaults entries ; TTY=pts/0 ; PWD=/etc/pam.d ; USER=root ;

As you can see I have pam_krb5[745]: error initializing kerberos: 13 (Permission denied). I’ve searched and found that the problem could be the permissions of krb5.conf, I’ve set it to 644:

-rw-r--r--. 1 root root 3.8K Jul 31 13:29 krb5.conf

but I have same error. I’ve also noticed that if I login and manually type kinit vbox I’m able to get the ticket. I can’t understand why I have Permission Denied error.

P.S
Here is the content of krb5.conf. https://pastebin.com/t7T2CsBH

share|improve this question

I’m trying to generate kerberos ticket when I login on my computer(Fedora 28). I want to achieve it using PAM. my /etc/pam.d/system-auth looks like this:

auth        required                                     pam_env.so
auth        required                                     pam_faildelay.so delay=2000000
auth        [default=1 ignore=ignore success=ok]         pam_succeed_if.so uid >= 1000 quiet
auth        [default=1 ignore=ignore success=ok]         pam_localuser.so
auth        sufficient                                   pam_unix.so nullok try_first_pass
auth        requisite                                    pam_succeed_if.so uid >= 1000 quiet_success
#auth        sufficient                                   pam_sss.so forward_pass
auth        sufficient                                   pam_krb5.so try_first_pass
auth        required                                     pam_deny.so

account     required                                     pam_unix.so
account     sufficient                                   pam_localuser.so
account     sufficient                                   pam_succeed_if.so uid < 1000 quiet
#account     [default=bad success=ok user_unknown=ignore] pam_sss.so
account     [default=bad success=ok user_unknown=ignore] pam_krb5.so
account     required                                     pam_permit.so

password    requisite                                    pam_pwquality.so try_first_pass local_users_only
password    sufficient                                   pam_unix.so sha512 shadow nullok try_first_pass use_authtok
#password    sufficient                                   pam_sss.so use_authtok
password    sufficient                                   pam_krb5.so use_authtok
password    required                                     pam_deny.so

session     optional                                     pam_keyinit.so revoke
session     required                                     pam_limits.so
-session    optional                                     pam_systemd.so
session     [success=1 default=ignore]                   pam_succeed_if.so service in crond quiet use_uid
session     required                                     pam_unix.so
#session     optional                                     pam_sss.so
session     optional                                     pam_krb5.so

and here are the logs from /var/log/secure:

Sep 12 12:48:04 vbox sudo[1408]:    vbox : problem with defaults entries ; TTY=tty1 ; PWD=/etc ; USER=root ;
Sep 12 12:48:05 vbox sudo[1408]:    vbox : TTY=tty1 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chown root:root krb5.keytab
Sep 12 12:48:05 vbox sudo[1408]: pam_systemd(sudo:session): Cannot create session: Already running in a session
Sep 12 12:48:05 vbox sudo[1408]: pam_unix(sudo:session): session opened for user root by vbox(uid=0)
Sep 12 12:48:05 vbox sudo[1408]: pam_unix(sudo:session): session closed for user root
Sep 12 12:48:07 vbox sudo[1413]:    vbox : problem with defaults entries ; TTY=tty1 ; PWD=/etc ; USER=root ;
Sep 12 12:48:07 vbox sudo[1413]:    vbox : TTY=tty1 ; PWD=/etc ; USER=root ; COMMAND=/usr/sbin/reboot
Sep 12 12:48:07 vbox sudo[1413]: pam_systemd(sudo:session): Cannot create session: Already running in a session
Sep 12 12:48:07 vbox sudo[1413]: pam_unix(sudo:session): session opened for user root by vbox(uid=0)
Sep 12 12:48:07 vbox login[746]: pam_unix(login:session): session closed for user vbox
Sep 12 12:48:07 vbox login[746]: pam_krb5[746]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:48:07 vbox login[746]: pam_krb5[746]: error initializing Kerberos
Sep 12 12:48:07 vbox sudo[1413]: pam_unix(sudo:session): session closed for user root
Sep 12 12:48:07 vbox systemd[1092]: pam_unix(systemd-user:session): session closed for user vbox
Sep 12 12:48:07 vbox systemd[1092]: pam_krb5[1092]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:48:07 vbox systemd[1092]: pam_krb5[1092]: error initializing Kerberos
Sep 12 12:48:13 vbox sshd[739]: Received signal 15; terminating.
Sep 12 12:48:43 vbox sshd[728]: Server listening on 0.0.0.0 port 22.
Sep 12 12:48:43 vbox sshd[728]: Server listening on :: port 22.
Sep 12 12:48:46 vbox polkitd[766]: Loading rules from directory /etc/polkit-1/rules.d
Sep 12 12:48:46 vbox polkitd[766]: Loading rules from directory /usr/share/polkit-1/rules.d
Sep 12 12:48:47 vbox polkitd[766]: Finished loading, compiling and executing 13 rules
Sep 12 12:48:47 vbox polkitd[766]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
Sep 12 12:49:11 vbox systemd[1093]: pam_unix(systemd-user:session): session opened for user vbox by (uid=0)
Sep 12 12:49:11 vbox systemd[1093]: pam_krb5[1093]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:49:11 vbox systemd[1093]: pam_krb5[1093]: error initializing Kerberos
Sep 12 12:49:12 vbox login[745]: pam_unix(login:session): session opened for user vbox by LOGIN(uid=0)
Sep 12 12:49:12 vbox login[745]: pam_krb5[745]: error initializing kerberos: 13 (Permission denied)
Sep 12 12:49:12 vbox login[745]: pam_krb5[745]: error initializing Kerberos
Sep 12 12:49:12 vbox login[745]: LOGIN ON tty1 BY vbox
Sep 12 12:57:20 vbox sshd[1200]: Accepted password for vbox from 192.168.1.53 port 54824 ssh2
Sep 12 12:57:20 vbox sshd[1200]: pam_unix(sshd:session): session opened for user vbox by (uid=0)
Sep 12 12:58:26 vbox sudo[1255]:    vbox : problem with defaults entries ; TTY=pts/0 ; PWD=/etc/pam.d ; USER=root ;

As you can see I have pam_krb5[745]: error initializing kerberos: 13 (Permission denied). I’ve searched and found that the problem could be the permissions of krb5.conf, I’ve set it to 644:

-rw-r--r--. 1 root root 3.8K Jul 31 13:29 krb5.conf

but I have same error. I’ve also noticed that if I login and manually type kinit vbox I’m able to get the ticket. I can’t understand why I have Permission Denied error.

P.S
Here is the content of krb5.conf. https://pastebin.com/t7T2CsBH

fedora login pam session

share|improve this question

share|improve this question

share|improve this question

share|improve this question

edited Sep 12 at 9:50

asked Sep 12 at 9:02

user3503143

162

162

  • Please add the contents of your krb5.conf
    – Rui F Ribeiro
    Sep 12 at 9:41

  • pastebin.com/t7T2CsBH thank you for your response 🙂
    – user3503143
    Sep 12 at 9:50

  • You should have your domain in there for tickets to work, I think. At least that what I used to do. I usually only had a few lines in that file. From the top of my head, I also think that file does not like comments, or at least not comments on the configuration lines.
    – Rui F Ribeiro
    Sep 12 at 9:56

  • Please add the contents of your krb5.conf
    – Rui F Ribeiro
    Sep 12 at 9:41

  • pastebin.com/t7T2CsBH thank you for your response 🙂
    – user3503143
    Sep 12 at 9:50

  • You should have your domain in there for tickets to work, I think. At least that what I used to do. I usually only had a few lines in that file. From the top of my head, I also think that file does not like comments, or at least not comments on the configuration lines.
    – Rui F Ribeiro
    Sep 12 at 9:56

Please add the contents of your krb5.conf
– Rui F Ribeiro
Sep 12 at 9:41

Please add the contents of your krb5.conf
– Rui F Ribeiro
Sep 12 at 9:41

pastebin.com/t7T2CsBH thank you for your response 🙂
– user3503143
Sep 12 at 9:50

pastebin.com/t7T2CsBH thank you for your response 🙂
– user3503143
Sep 12 at 9:50

You should have your domain in there for tickets to work, I think. At least that what I used to do. I usually only had a few lines in that file. From the top of my head, I also think that file does not like comments, or at least not comments on the configuration lines.
– Rui F Ribeiro
Sep 12 at 9:56

You should have your domain in there for tickets to work, I think. At least that what I used to do. I usually only had a few lines in that file. From the top of my head, I also think that file does not like comments, or at least not comments on the configuration lines.
– Rui F Ribeiro
Sep 12 at 9:56

active

oldest

votes

Your Answer

StackExchange.ready(function() {
var channelOptions = {
tags: “”.split(” “),
id: “106”
};
initTagRenderer(“”.split(” “), “”.split(” “), channelOptions);

StackExchange.using(“externalEditor”, function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using(“snippets”, function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: ‘answer’,
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: “”,
onDemand: true,
discardSelector: “.discard-answer”
,immediatelyShowMarkdownHelp:true
});

}
});

 
draft saved
draft discarded

StackExchange.ready(
function () {
StackExchange.openid.initPostLogin(‘.new-post-login’, ‘https%3a%2f%2funix.stackexchange.com%2fquestions%2f468460%2ffedora-28-generate-kerberos-ticket-on-login%23new-answer’, ‘question_page’);
}
);

Post as a guest

active

oldest

votes

active

oldest

votes

active

oldest

votes

active

oldest

votes

 
draft saved
draft discarded

 

draft saved

draft discarded

StackExchange.ready(
function () {
StackExchange.openid.initPostLogin(‘.new-post-login’, ‘https%3a%2f%2funix.stackexchange.com%2fquestions%2f468460%2ffedora-28-generate-kerberos-ticket-on-login%23new-answer’, ‘question_page’);
}
);

Post as a guest

Yeah But No But Yeah

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

up vote
44
down vote

favorite

10

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

share|improve this question

  • 3

    Can we return a list of lines?
    – Jo King
    Sep 12 at 8:20

  • 10

    It must entertaining to work with such a funny chap! :s On a slightly more serious note: the nrOfButs variable is rather poorly-named and misleading. Nice simple challenge anyway.
    – Arnauld
    Sep 12 at 9:54

  • 9

    Do we get a bonus if the last line is “God can’t believe you just said that!”
    – Ciaran_McCarthy
    Sep 12 at 10:24

  • 3

    @EriktheOutgolfer the ifs fall trough and continue in the current loop if their condition was satisfied.
    – dzaima
    Sep 12 at 15:35

  • 4

    The most Australian codegolf yet? Except it should be “nah”
    – Nacht
    Sep 13 at 2:00

up vote
44
down vote

favorite

10

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

share|improve this question

  • 3

    Can we return a list of lines?
    – Jo King
    Sep 12 at 8:20

  • 10

    It must entertaining to work with such a funny chap! :s On a slightly more serious note: the nrOfButs variable is rather poorly-named and misleading. Nice simple challenge anyway.
    – Arnauld
    Sep 12 at 9:54

  • 9

    Do we get a bonus if the last line is “God can’t believe you just said that!”
    – Ciaran_McCarthy
    Sep 12 at 10:24

  • 3

    @EriktheOutgolfer the ifs fall trough and continue in the current loop if their condition was satisfied.
    – dzaima
    Sep 12 at 15:35

  • 4

    The most Australian codegolf yet? Except it should be “nah”
    – Nacht
    Sep 13 at 2:00

up vote
44
down vote

favorite

10

up vote
44
down vote

favorite

10
10

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

share|improve this 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

code-golf string

share|improve this question

share|improve this question

share|improve this question

share|improve this question

asked Sep 12 at 7:59

maxb

1,5491621

1,5491621

  • 3

    Can we return a list of lines?
    – Jo King
    Sep 12 at 8:20

  • 10

    It must entertaining to work with such a funny chap! :s On a slightly more serious note: the nrOfButs variable is rather poorly-named and misleading. Nice simple challenge anyway.
    – Arnauld
    Sep 12 at 9:54

  • 9

    Do we get a bonus if the last line is “God can’t believe you just said that!”
    – Ciaran_McCarthy
    Sep 12 at 10:24

  • 3

    @EriktheOutgolfer the ifs fall trough and continue in the current loop if their condition was satisfied.
    – dzaima
    Sep 12 at 15:35

  • 4

    The most Australian codegolf yet? Except it should be “nah”
    – Nacht
    Sep 13 at 2:00

  • 3

    Can we return a list of lines?
    – Jo King
    Sep 12 at 8:20

  • 10

    It must entertaining to work with such a funny chap! :s On a slightly more serious note: the nrOfButs variable is rather poorly-named and misleading. Nice simple challenge anyway.
    – Arnauld
    Sep 12 at 9:54

  • 9

    Do we get a bonus if the last line is “God can’t believe you just said that!”
    – Ciaran_McCarthy
    Sep 12 at 10:24

  • 3

    @EriktheOutgolfer the ifs fall trough and continue in the current loop if their condition was satisfied.
    – dzaima
    Sep 12 at 15:35

  • 4

    The most Australian codegolf yet? Except it should be “nah”
    – Nacht
    Sep 13 at 2:00

3

3

Can we return a list of lines?
– Jo King
Sep 12 at 8:20

Can we return a list of lines?
– Jo King
Sep 12 at 8:20

10

10

It must entertaining to work with such a funny chap! :s On a slightly more serious note: the nrOfButs variable is rather poorly-named and misleading. Nice simple challenge anyway.
– Arnauld
Sep 12 at 9:54

It must entertaining to work with such a funny chap! :s On a slightly more serious note: the nrOfButs variable is rather poorly-named and misleading. Nice simple challenge anyway.
– Arnauld
Sep 12 at 9:54

9

9

Do we get a bonus if the last line is “God can’t believe you just said that!”
– Ciaran_McCarthy
Sep 12 at 10:24

Do we get a bonus if the last line is “God can’t believe you just said that!”
– Ciaran_McCarthy
Sep 12 at 10:24

3

3

@EriktheOutgolfer the ifs fall trough and continue in the current loop if their condition was satisfied.
– dzaima
Sep 12 at 15:35

@EriktheOutgolfer the ifs fall trough and continue in the current loop if their condition was satisfied.
– dzaima
Sep 12 at 15:35

4

4

The most Australian codegolf yet? Except it should be “nah”
– Nacht
Sep 13 at 2:00

The most Australian codegolf yet? Except it should be “nah”
– Nacht
Sep 13 at 2:00

36 Answers
36

active

oldest

votes

1 2
next

up vote
45
down vote

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

share|improve this answer

  • 1

    I have no way of verifying this, but your description makes it seem correct. Can you add some example input/output pairs? One of the more ridiculous languages, but great answer nonetheless.
    – maxb
    Sep 12 at 14:09

  • 15

    @maxb Can’t be all that ridiculous when it is beating other languages.
    – Keeta
    Sep 12 at 14:21

  • 1

    Great explanation and very cool technique. Works in LibreOffice Calc as well but might need some playing with the formatting. +1
    – ElPedro
    Sep 12 at 17:32

up vote
20
down vote

JavaScript (ES6), 59 57 bytes

f=n=>n?f(n-1)+[s=n&1?`But
`:'',`Yeah
`+s,s+`No
`][n%3]:''

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 $nequiv1pmod 3$, output “Yeah”
  • if $nequiv1pmod 2$, output “But”
  • if $nequiv2pmod 3$, output “No”

This allows us to store the simpler case $nequiv0pmod 3$ as the first entry of our lookup array, where we can define $s$: a variable holding either "Butn" or an empty string.

The two other entries are defined as "Yeahn" + s and s + "Non" 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.

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:
        `Butn`     //       set s to "But"
      :             //     else:
        '',         //       set s to an empty string
      `Yeahn` + s, //     2nd entry: "Yeah" followed by s
      s + `Non`    //     3rd entry: s followed by "No"
    ][n % 3]        //   append the correct entry for this iteration
  :                 // else:
    ''              //   return an empty string and stop recursion

share|improve this answer

    up vote
    15
    down vote

    LOLCODE, 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!

    share|improve this answer

    • 2

      It looks awesome (I would hate to code this!), but in test case 10 the 2nd “No” and 3rd “But” get flipped… So Yeah, but no 😀
      – seadoggie01
      Sep 13 at 3:23

    • 2

      Whoops, thought I could optimize there. This is a tricky pattern. I fixed it now.
      – JosiahRyanW
      Sep 13 at 6:45

    • 1

      I love the way it reads
      – LocustHorde
      Sep 13 at 15:51

    • 3

      Does VISIBLE "But" refer to the program’s lack of trousers?
      – JDL
      Sep 14 at 14:03

    up vote
    13
    down vote

    Whitespace, 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 (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 “Yeahn”, “Butn”, “Non”). 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 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 that I’ve also used to golf another Whitespace answer of mine before. 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.

    share|improve this answer

    • 1

      I most certainly did not expect a Whitespace answer. Good job!
      – maxb
      Sep 12 at 12:31

    • @maxb Thanks! Unfortunately it’s quite a bit longer than expected due to the 8 labels it requires.. But I’m already happy it’s working. 🙂
      – Kevin Cruijssen
      Sep 12 at 12:37

    • Couldn’t you halve the labels by skipping to the next if statement if the condition is false? e.g. if i modulo-3 != 1 jump to next if else push NO
      – Jo King
      Sep 12 at 13:15

    • 1

      @JoKing Ah wait, I misunderstood a part of your pseudo-code. My first issue about not retrieving i before the if(i is 0) call PRINT is true, but your other is checking the i before subtracting it and skipping over the prints. Pretty smart actually. Will continue implementing it.
      – Kevin Cruijssen
      Sep 13 at 10:00

    • 1

      Well, if you jump to the start of the loop, it will run the if statement again and jump straight back to the print function. Maybe this saves a byte if you change the loop label to the empty label
      – Jo King
      Sep 13 at 12:40

    up vote
    11
    down vote

    Python 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!


    Python 3, 79 76 bytes

    Port of Keeta’s Excel answer.

    lambda n:(f"""Yeah
    But
    No      
    But     
    Yeah    
    But
    No{'':11}
    """*n)[:9*n]
    

    Try it online!

    share|improve this answer

      up vote
      11
      down vote

      Perl 6, 63 50 bytes

      {<<"Yeah But"No But Yeah"But No">>[^$_ X%6].words}
      

      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
      

      share|improve this answer

        up vote
        8
        down vote

        C (gcc), 75 bytes

        f(o,_){for(_=0;o-_;_++%3-1||puts("No"))_%3||puts("Yeah"),1&_||puts("But");}
        

        Try it online!


        C (gcc), 60 + 11 = 71 bytes (using -D$=||puts()

        f(o,_){for(_=0;o-_;_++%3-1 $"No"))_%3 $"Yeah"),1&_ $"But");}
        

        Try it online!

        share|improve this answer

          up vote
          8
          down vote

          05AB1E (legacy), 27 25 24 bytes

          Saved 1 byte thanks to Kevin Cruijssen.

          F”¥æ€³€¸”#N3ÖNÈN3%‚‚˜Ï`»
          

          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
          

          share|improve this answer

          • Dang, you beat me to it.. Was about to post an answer. Yours is shorter anyway, so +1 from me.. Nice use of ×, hadn’t thought about that!
            – Kevin Cruijssen
            Sep 12 at 8:27

          • Wow, I’d love an explanation on this one. My personal best was 44 bytes in CJam.
            – maxb
            Sep 12 at 8:29

          • @maxb: I will of course add an explanation. I’m just checking to see if I can golf it down some more first 😉
            – Emigna
            Sep 12 at 8:30

          • You can remove the Θ now that you’re no longer using ×, since Ï will only look at 1s only, so it ignores the 2 (and 0 of course).
            – Kevin Cruijssen
            Sep 12 at 9:32

          • @KevinCruijssen: Thanks! Not sure how I missed that 😛
            – Emigna
            Sep 12 at 9:51

          up vote
          7
          down vote

          Python 2, 73 bytes

          lambda n:'n'.join((["YeahnBut","No","But","Yeah","ButnNo"]*n)[:n-n/6])
          

          Try it online!

          share|improve this answer

            up vote
            6
            down vote

            Python 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!

            -2 bytes, thanks to ovs


            Python 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!

            -4 bytes, thanks to ovs

            -4 bytes, thanks to Jo King

            share|improve this answer

            • 86 bytes by combining the two and returning as a list of lines
              – Jo King
              Sep 12 at 13:09

            • @JoKing Thanks, didn’t know that I could return instead of printing when wrote it.
              – TFeld
              Sep 12 at 13:14

            • 82 bytes: len(w)<3 -> 'N'in w, 81 bytes : len(w)%2 -> (w<'N')
              – ovs
              Sep 12 at 13:22

            • @ovs Thanks, 🙂
              – TFeld
              Sep 12 at 13:27

            up vote
            6
            down vote

            Groovy (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?'':'Yeahn')+(n%2?'':'Butn')+(n%3==1?'Non':''):''}
            

            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!

            Groovy (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?'':'Yeahn')+(it%2?'':'Butn')+(it%3==1?'Non':''))}
            

            Try it online!

            share|improve this answer

            • Welcome to PPCG! Great first answer! I haven’t coded any Groovy myself, but might I suggest running your code on TIO? That way, it can be validated by others, and enjoyed by all.
              – maxb
              Sep 12 at 15:20

            • 1

              @maxb Thanks! I’ve added one 🙂
              – archangel.mjj
              Sep 12 at 15:29

            • Nice first answer and also welcome to PPCG.
              – ElPedro
              Sep 12 at 18:03

            up vote
            5
            down vote

            Retina 0.8.2, 45 bytes

            .+
            $*
            1
            $`Yeah¶$`But¶$`11No¶
            +`11B
            B
            111
            
            A`1
            

            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 1s before it, except for No, which has two extra 1s so that we calculate (i+2)%3==0 which is equivalent to i%3==1.

            +`11B
            B
            

            Remove pairs of 1s before Bs.

            111
            

            Remove 1s in groups of three everywhere else.

            A`1
            

            Delete all lines that still have a 1.

            share|improve this answer

            • Oh, now that I see 11No¶ to calculate (i+2)%3==0 (so all three are if-checks for ==0) it looks so obvious, but I wouldn’t have thought of that myself, so it’s actually quite ingenious. +1 from me, nice answer!
              – Kevin Cruijssen
              Sep 12 at 12:51

            up vote
            5
            down vote

            Canvas, 27 bytes

            {╷⌐3%‽YeahP}2%‽ButP}3%╷‽NoP
            

            Try it here!

            share|improve this answer

              up vote
              5
              down vote

              Java 10, 100 99 bytes

              n->{for(int i=0;i<n;)System.out.print((i%3<1?"Yeahn":"")+(i%2<1?"Butn":"")+(++i%3>1?"Non":""));}
              

              -1 byte thanks to @OlivierGrégoire.

              Try it online.

              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:
                      "Yeahn"       //     Print "Yeah" with newline
                    :"")+(i%2<1?     //    If `i` is even:
                      "Butn"        //     Print "But" with newline
                    :"")+(++i%3>1?   //    If `i` modulo-3 is 1:
                      "Non"         //     Print "No" with newline
                    :                //    If none of the above three if's applied to the current `i`:
                     ""));}          //     Print nothing for the current `i`
              

              share|improve this answer

              • 1

                ++i%3>1 will likely save you a byte
                – Olivier Grégoire
                Sep 12 at 22:56

              • @OlivierGrégoire Ah, of course. Thanks!
                – Kevin Cruijssen
                Sep 13 at 7:40

              up vote
              5
              down vote

              Powershell, 75 74 72 67 66 bytes

              -1 byte thanks 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]}}
              

              share|improve this answer

              • 1

                Great answer! Would it be possible to add some output to the answer, since it doesn’t include an online interpreter?
                – maxb
                Sep 12 at 13:36

              • The answer scriptblock does not return ======. It generates Yeah,But,No strings only. The test script shows a separator for easier reading of the results only.
                – mazzy
                Sep 12 at 14:10

              • That hashtable usage is clever. I’m going to need to remember that.
                – AdmBorkBork
                Sep 12 at 18:35

              • @maxb – a tio.run online interpreter link for the 67 byte answer
                – TessellatingHeckler
                Sep 17 at 5:07

              • 1

                @mazzy I can reformulate yours, but still can’t beat 67 (replace the two n with real newlines) (" YeahnBut No But Yeah ButnNo "*($j="$args")|% s*t 32)[1..$j]-ne''
                – TessellatingHeckler
                Sep 17 at 5:49

              up vote
              4
              down vote

              Haskell, 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!

              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
              

              share|improve this answer

                up vote
                4
                down vote

                C# (Visual C# Interactive Compiler), 105 99 94 96 89bytes

                i=>{for(int x=0;x<i;)Write((x%3<1?"Yeahn":"")+(x%2<1?"Butn":"")+(x++%3==1?"Non":""));}
                

                Try it online!

                share|improve this answer

                • 4

                  Removing the interpolation like this saves 7 bytes.
                  – Emigna
                  Sep 12 at 10:43

                • @Emigna Thanks for the tip, changed the answer
                  – auhmaan
                  Sep 12 at 16:33

                • 1

                  x++%3==1? can be ++x%3>1?. Someone else just tipped it for my Java answer, but the same applies to your C# answer. 🙂
                  – Kevin Cruijssen
                  Sep 13 at 7:41

                up vote
                4
                down vote

                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!

                Explanation

                This explanation is for the previous version–see below for changelog

                Inspired by Jo King’s Perl 6 answer. 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.

                share|improve this answer

                  up vote
                  4
                  down vote

                  Attache, 48 bytes

                  Flat##{Mask[_%3'2'3=0'0'1,$Yeah'$But'$No]}=>Iota
                  

                  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
                  

                  share|improve this answer

                    up vote
                    4
                    down vote

                    C (gcc), 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!

                    share|improve this answer

                    • @JonathanFrech Nice but doesn’t work for zero, or 5
                      – cleblanc
                      Sep 18 at 17:04

                    • @cleblanc Oh, sorry. Did not realize … At least removing j saved you two bytes.
                      – Jonathan Frech
                      Sep 18 at 17:46

                    • 1

                      70 bytes — incorporating @ceilingcat’s one saved byte.
                      – Jonathan Frech
                      Sep 18 at 18:01

                    • 1

                      n-~-i is equivalent to n-i+1 — not i<n+1 — and so does not actually save any bytes …
                      – Jonathan Frech
                      Sep 18 at 19:16

                    up vote
                    3
                    down vote

                    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

                    share|improve this answer

                      up vote
                      3
                      down vote

                      Python 3, 93 bytes

                      [print("Yeahn"*(i%3<1)+"Butn"*(i%2<1)+"Non"*(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!

                      share|improve this answer

                      • 1

                        If you already have an expression you can use in a list comprehension but your list comprehension only exists to evoke that expression’s side effects, a plain for loop requires less bytes.
                        – Jonathan Frech
                        Sep 14 at 2:21

                      up vote
                      3
                      down vote

                      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)

                      share|improve this answer

                        up vote
                        3
                        down vote

                        sed -E, 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(.*).-:21:;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.

                        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(.*).-:21:;        | 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
                        

                        share|improve this answer

                        • Can you add some explanations please ?
                          – user285259
                          Sep 21 at 8:30

                        • 1

                          @user285259 Done.
                          – hidefromkgb
                          Sep 21 at 13:21

                        up vote
                        2
                        down vote

                        Clean, 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!

                        share|improve this answer

                          up vote
                          2
                          down vote

                          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!

                          -2 bytes changing from i=0 to p-1 to i=1 to p and adjusting modulos. Apart from that, pretty straight-forward.

                          share|improve this answer

                          • 1

                            I get some kind of build error for the TIO link, perhaps a syntax error in the testing code?
                            – maxb
                            Sep 13 at 8:15

                          • Thanks for that. My original solution printed directly to the console, but then I tried returning a sequence and it turned out to be shorter by about 2 bytes. So I changed the code in the TIO but forgot to update the footer – which was still expecting the v function to print everything out.
                            – Ciaran_McCarthy
                            Sep 13 at 8:36

                          • 2

                            Shave 2 bytes with i=1 to p (and adjusting moduli, naturally). Reverse ranges are empty. 🙂
                            – user82031
                            Sep 13 at 18:16

                          • Nice! I’ve added that. Thanks! 🙂
                            – Ciaran_McCarthy
                            Sep 13 at 20:56

                          up vote
                          2
                          down vote

                          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.

                          share|improve this answer

                          • It looks good, but it produces an extra newline in the middle for n=10
                            – maxb
                            Sep 13 at 21:02

                          • @maxb Thanks for the hint. I could have fixed it with 9 extra bytes; but the other approach is shorter.
                            – Titus
                            Sep 13 at 23:50

                          up vote
                          2
                          down vote

                          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=i2,"","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
                          

                          share|improve this answer

                          • @Keeta good idea, but no… If you look at my first code, I use [a1] which means Range/cell .value 🙂 I should’ve made it more clear that was an explanation though, sorry :/
                            – seadoggie01
                            Sep 14 at 13:20

                          • 1

                            Yeah, I saw that and tried to delete the comment. How about using i/3=i3 instead of i mod 3 = 0 (and same for mod 2 = 0). Haven’t tried it, but would it work?
                            – Keeta
                            Sep 14 at 13:24

                          • @Keeta I’ve never seen the operator before… I don’t think so though, it returns the value of division without the remainder… like the opposite of Mod I think
                            – seadoggie01
                            Sep 14 at 13:28

                          • One is integer division and one is floating point. 7/3 = 2.3333 where 73 = 2 (truncate division). 6/3 should be 2, and 63 should also be 2 so it should work whenever remainder is zero (I think).
                            – Keeta
                            Sep 14 at 13:30

                          • 1

                            VBA will automatically concatenate function outputs, so you can drop the & between eachIIf(..) for an extra 2 bytes
                            – Chronocidal
                            Sep 14 at 15:40

                          up vote
                          2
                          down vote

                          Jelly, 22 bytes

                          5Rż7FṚṁị“'⁴ÆẓNƇ»ḲŒP¤Ẏ
                          

                          A monadic Link yielding a list of lines (which seems to have been allowed in comments)

                          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 $2times3=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"]
                          

                          share|improve this answer

                          • I doubt it’s going to get any shorter than this. Fantastic answer, and a great explanation, well done!
                            – maxb
                            Sep 17 at 5:01

                          up vote
                          2
                          down vote

                          Python 2, 93 92 83 bytes

                          lambda i:''.join('Yeahn'*(x%3<1)+'Butn'*(x%2<1)+'Non'*(x%3==1)for x in range(i))
                          

                          Try it online!

                          A massive 9 bytes saved with thanks to @Jonathan Frech

                          share|improve this answer

                          • You could use string repetition instead of tuple indexing — ('','Yeahn')[x%3<1] is equivalent to "Yeahn"*(x%3<1).
                            – Jonathan Frech
                            Sep 16 at 10:34

                          • @JonathanFrech – very cool! Similar technique can be applied to the other cases as well. Many thanks!
                            – ElPedro
                            Sep 17 at 8:10

                          1 2
                          next

                          Your Answer

                          StackExchange.ifUsing(“editor”, function () {
                          return StackExchange.using(“mathjaxEditing”, function () {
                          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [[“\$”, “\$”]]);
                          });
                          });
                          }, “mathjax-editing”);

                          StackExchange.ifUsing(“editor”, function () {
                          StackExchange.using(“externalEditor”, function () {
                          StackExchange.using(“snippets”, function () {
                          StackExchange.snippets.init();
                          });
                          });
                          }, “code-snippets”);

                          StackExchange.ready(function() {
                          var channelOptions = {
                          tags: “”.split(” “),
                          id: “200”
                          };
                          initTagRenderer(“”.split(” “), “”.split(” “), channelOptions);

                          StackExchange.using(“externalEditor”, function() {
                          // Have to fire editor after snippets, if snippets enabled
                          if (StackExchange.settings.snippets.snippetsEnabled) {
                          StackExchange.using(“snippets”, function() {
                          createEditor();
                          });
                          }
                          else {
                          createEditor();
                          }
                          });

                          function createEditor() {
                          StackExchange.prepareEditor({
                          heartbeatType: ‘answer’,
                          convertImagesToLinks: false,
                          noModals: false,
                          showLowRepImageUploadWarning: true,
                          reputationToPostImages: null,
                          bindNavPrevention: true,
                          postfix: “”,
                          onDemand: true,
                          discardSelector: “.discard-answer”
                          ,immediatelyShowMarkdownHelp:true
                          });

                          }
                          });

                           
                          draft saved
                          draft discarded

                          StackExchange.ready(
                          function () {
                          StackExchange.openid.initPostLogin(‘.new-post-login’, ‘https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f172036%2fyeah-but-no-but-yeah%23new-answer’, ‘question_page’);
                          }
                          );

                          Post as a guest

                          36 Answers
                          36

                          active

                          oldest

                          votes

                          36 Answers
                          36

                          active

                          oldest

                          votes

                          active

                          oldest

                          votes

                          active

                          oldest

                          votes

                          1 2
                          next

                          up vote
                          45
                          down vote

                          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

                          share|improve this answer

                          • 1

                            I have no way of verifying this, but your description makes it seem correct. Can you add some example input/output pairs? One of the more ridiculous languages, but great answer nonetheless.
                            – maxb
                            Sep 12 at 14:09

                          • 15

                            @maxb Can’t be all that ridiculous when it is beating other languages.
                            – Keeta
                            Sep 12 at 14:21

                          • 1

                            Great explanation and very cool technique. Works in LibreOffice Calc as well but might need some playing with the formatting. +1
                            – ElPedro
                            Sep 12 at 17:32

                          up vote
                          45
                          down vote

                          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

                          share|improve this answer

                          • 1

                            I have no way of verifying this, but your description makes it seem correct. Can you add some example input/output pairs? One of the more ridiculous languages, but great answer nonetheless.
                            – maxb
                            Sep 12 at 14:09

                          • 15

                            @maxb Can’t be all that ridiculous when it is beating other languages.
                            – Keeta
                            Sep 12 at 14:21

                          • 1

                            Great explanation and very cool technique. Works in LibreOffice Calc as well but might need some playing with the formatting. +1
                            – ElPedro
                            Sep 12 at 17:32

                          up vote
                          45
                          down vote

                          up vote
                          45
                          down vote

                          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

                          share|improve this 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

                          share|improve this answer

                          share|improve this answer

                          share|improve this answer

                          edited Sep 12 at 14:18

                          answered Sep 12 at 14:05

                          Keeta

                          737310

                          737310

                          • 1

                            I have no way of verifying this, but your description makes it seem correct. Can you add some example input/output pairs? One of the more ridiculous languages, but great answer nonetheless.
                            – maxb
                            Sep 12 at 14:09

                          • 15

                            @maxb Can’t be all that ridiculous when it is beating other languages.
                            – Keeta
                            Sep 12 at 14:21

                          • 1

                            Great explanation and very cool technique. Works in LibreOffice Calc as well but might need some playing with the formatting. +1
                            – ElPedro
                            Sep 12 at 17:32

                          • 1

                            I have no way of verifying this, but your description makes it seem correct. Can you add some example input/output pairs? One of the more ridiculous languages, but great answer nonetheless.
                            – maxb
                            Sep 12 at 14:09

                          • 15

                            @maxb Can’t be all that ridiculous when it is beating other languages.
                            – Keeta
                            Sep 12 at 14:21

                          • 1

                            Great explanation and very cool technique. Works in LibreOffice Calc as well but might need some playing with the formatting. +1
                            – ElPedro
                            Sep 12 at 17:32

                          1

                          1

                          I have no way of verifying this, but your description makes it seem correct. Can you add some example input/output pairs? One of the more ridiculous languages, but great answer nonetheless.
                          – maxb
                          Sep 12 at 14:09

                          I have no way of verifying this, but your description makes it seem correct. Can you add some example input/output pairs? One of the more ridiculous languages, but great answer nonetheless.
                          – maxb
                          Sep 12 at 14:09

                          15

                          15

                          @maxb Can’t be all that ridiculous when it is beating other languages.
                          – Keeta
                          Sep 12 at 14:21

                          @maxb Can’t be all that ridiculous when it is beating other languages.
                          – Keeta
                          Sep 12 at 14:21

                          1

                          1

                          Great explanation and very cool technique. Works in LibreOffice Calc as well but might need some playing with the formatting. +1
                          – ElPedro
                          Sep 12 at 17:32

                          Great explanation and very cool technique. Works in LibreOffice Calc as well but might need some playing with the formatting. +1
                          – ElPedro
                          Sep 12 at 17:32

                          up vote
                          20
                          down vote

                          JavaScript (ES6), 59 57 bytes

                          f=n=>n?f(n-1)+[s=n&1?`But
                          `:'',`Yeah
                          `+s,s+`No
                          `][n%3]:''
                          

                          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 $nequiv1pmod 3$, output “Yeah”
                          • if $nequiv1pmod 2$, output “But”
                          • if $nequiv2pmod 3$, output “No”

                          This allows us to store the simpler case $nequiv0pmod 3$ as the first entry of our lookup array, where we can define $s$: a variable holding either "Butn" or an empty string.

                          The two other entries are defined as "Yeahn" + s and s + "Non" 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.

                          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:
                                  `Butn`     //       set s to "But"
                                :             //     else:
                                  '',         //       set s to an empty string
                                `Yeahn` + s, //     2nd entry: "Yeah" followed by s
                                s + `Non`    //     3rd entry: s followed by "No"
                              ][n % 3]        //   append the correct entry for this iteration
                            :                 // else:
                              ''              //   return an empty string and stop recursion
                          

                          share|improve this answer

                            up vote
                            20
                            down vote

                            JavaScript (ES6), 59 57 bytes

                            f=n=>n?f(n-1)+[s=n&1?`But
                            `:'',`Yeah
                            `+s,s+`No
                            `][n%3]:''
                            

                            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 $nequiv1pmod 3$, output “Yeah”
                            • if $nequiv1pmod 2$, output “But”
                            • if $nequiv2pmod 3$, output “No”

                            This allows us to store the simpler case $nequiv0pmod 3$ as the first entry of our lookup array, where we can define $s$: a variable holding either "Butn" or an empty string.

                            The two other entries are defined as "Yeahn" + s and s + "Non" 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.

                            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:
                                    `Butn`     //       set s to "But"
                                  :             //     else:
                                    '',         //       set s to an empty string
                                  `Yeahn` + s, //     2nd entry: "Yeah" followed by s
                                  s + `Non`    //     3rd entry: s followed by "No"
                                ][n % 3]        //   append the correct entry for this iteration
                              :                 // else:
                                ''              //   return an empty string and stop recursion
                            

                            share|improve this answer

                              up vote
                              20
                              down vote

                              up vote
                              20
                              down vote

                              JavaScript (ES6), 59 57 bytes

                              f=n=>n?f(n-1)+[s=n&1?`But
                              `:'',`Yeah
                              `+s,s+`No
                              `][n%3]:''
                              

                              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 $nequiv1pmod 3$, output “Yeah”
                              • if $nequiv1pmod 2$, output “But”
                              • if $nequiv2pmod 3$, output “No”

                              This allows us to store the simpler case $nequiv0pmod 3$ as the first entry of our lookup array, where we can define $s$: a variable holding either "Butn" or an empty string.

                              The two other entries are defined as "Yeahn" + s and s + "Non" 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.

                              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:
                                      `Butn`     //       set s to "But"
                                    :             //     else:
                                      '',         //       set s to an empty string
                                    `Yeahn` + s, //     2nd entry: "Yeah" followed by s
                                    s + `Non`    //     3rd entry: s followed by "No"
                                  ][n % 3]        //   append the correct entry for this iteration
                                :                 // else:
                                  ''              //   return an empty string and stop recursion
                              

                              share|improve this 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!

                              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 $nequiv1pmod 3$, output “Yeah”
                              • if $nequiv1pmod 2$, output “But”
                              • if $nequiv2pmod 3$, output “No”

                              This allows us to store the simpler case $nequiv0pmod 3$ as the first entry of our lookup array, where we can define $s$: a variable holding either "Butn" or an empty string.

                              The two other entries are defined as "Yeahn" + s and s + "Non" 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.

                              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:
                                      `Butn`     //       set s to "But"
                                    :             //     else:
                                      '',         //       set s to an empty string
                                    `Yeahn` + s, //     2nd entry: "Yeah" followed by s
                                    s + `Non`    //     3rd entry: s followed by "No"
                                  ][n % 3]        //   append the correct entry for this iteration
                                :                 // else:
                                  ''              //   return an empty string and stop recursion
                              

                              share|improve this answer

                              share|improve this answer

                              share|improve this answer

                              edited Sep 12 at 9:33

                              answered Sep 12 at 8:22

                              Arnauld

                              65.5k581277

                              65.5k581277

                                  up vote
                                  15
                                  down vote

                                  LOLCODE, 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!

                                  share|improve this answer

                                  • 2

                                    It looks awesome (I would hate to code this!), but in test case 10 the 2nd “No” and 3rd “But” get flipped… So Yeah, but no 😀
                                    – seadoggie01
                                    Sep 13 at 3:23

                                  • 2

                                    Whoops, thought I could optimize there. This is a tricky pattern. I fixed it now.
                                    – JosiahRyanW
                                    Sep 13 at 6:45

                                  • 1

                                    I love the way it reads
                                    – LocustHorde
                                    Sep 13 at 15:51

                                  • 3

                                    Does VISIBLE "But" refer to the program’s lack of trousers?
                                    – JDL
                                    Sep 14 at 14:03

                                  up vote
                                  15
                                  down vote

                                  LOLCODE, 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!

                                  share|improve this answer

                                  • 2

                                    It looks awesome (I would hate to code this!), but in test case 10 the 2nd “No” and 3rd “But” get flipped… So Yeah, but no 😀
                                    – seadoggie01
                                    Sep 13 at 3:23

                                  • 2

                                    Whoops, thought I could optimize there. This is a tricky pattern. I fixed it now.
                                    – JosiahRyanW
                                    Sep 13 at 6:45

                                  • 1

                                    I love the way it reads
                                    – LocustHorde
                                    Sep 13 at 15:51

                                  • 3

                                    Does VISIBLE "But" refer to the program’s lack of trousers?
                                    – JDL
                                    Sep 14 at 14:03

                                  up vote
                                  15
                                  down vote

                                  up vote
                                  15
                                  down vote

                                  LOLCODE, 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!

                                  share|improve this answer

                                  LOLCODE, 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!

                                  share|improve this answer

                                  share|improve this answer

                                  share|improve this answer

                                  edited Sep 13 at 6:44

                                  answered Sep 13 at 0:52

                                  JosiahRyanW

                                  5216

                                  5216

                                  • 2

                                    It looks awesome (I would hate to code this!), but in test case 10 the 2nd “No” and 3rd “But” get flipped… So Yeah, but no 😀
                                    – seadoggie01
                                    Sep 13 at 3:23

                                  • 2

                                    Whoops, thought I could optimize there. This is a tricky pattern. I fixed it now.
                                    – JosiahRyanW
                                    Sep 13 at 6:45

                                  • 1

                                    I love the way it reads
                                    – LocustHorde
                                    Sep 13 at 15:51

                                  • 3

                                    Does VISIBLE "But" refer to the program’s lack of trousers?
                                    – JDL
                                    Sep 14 at 14:03

                                  • 2

                                    It looks awesome (I would hate to code this!), but in test case 10 the 2nd “No” and 3rd “But” get flipped… So Yeah, but no 😀
                                    – seadoggie01
                                    Sep 13 at 3:23

                                  • 2

                                    Whoops, thought I could optimize there. This is a tricky pattern. I fixed it now.
                                    – JosiahRyanW
                                    Sep 13 at 6:45

                                  • 1

                                    I love the way it reads
                                    – LocustHorde
                                    Sep 13 at 15:51

                                  • 3

                                    Does VISIBLE "But" refer to the program’s lack of trousers?
                                    – JDL
                                    Sep 14 at 14:03

                                  2

                                  2

                                  It looks awesome (I would hate to code this!), but in test case 10 the 2nd “No” and 3rd “But” get flipped… So Yeah, but no 😀
                                  – seadoggie01
                                  Sep 13 at 3:23

                                  It looks awesome (I would hate to code this!), but in test case 10 the 2nd “No” and 3rd “But” get flipped… So Yeah, but no 😀
                                  – seadoggie01
                                  Sep 13 at 3:23

                                  2

                                  2

                                  Whoops, thought I could optimize there. This is a tricky pattern. I fixed it now.
                                  – JosiahRyanW
                                  Sep 13 at 6:45

                                  Whoops, thought I could optimize there. This is a tricky pattern. I fixed it now.
                                  – JosiahRyanW
                                  Sep 13 at 6:45

                                  1

                                  1

                                  I love the way it reads
                                  – LocustHorde
                                  Sep 13 at 15:51

                                  I love the way it reads
                                  – LocustHorde
                                  Sep 13 at 15:51

                                  3

                                  3

                                  Does VISIBLE "But" refer to the program’s lack of trousers?
                                  – JDL
                                  Sep 14 at 14:03

                                  Does VISIBLE "But" refer to the program’s lack of trousers?
                                  – JDL
                                  Sep 14 at 14:03

                                  up vote
                                  13
                                  down vote

                                  Whitespace, 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 (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 “Yeahn”, “Butn”, “Non”). 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 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 that I’ve also used to golf another Whitespace answer of mine before. 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.

                                  share|improve this answer

                                  • 1

                                    I most certainly did not expect a Whitespace answer. Good job!
                                    – maxb
                                    Sep 12 at 12:31

                                  • @maxb Thanks! Unfortunately it’s quite a bit longer than expected due to the 8 labels it requires.. But I’m already happy it’s working. 🙂
                                    – Kevin Cruijssen
                                    Sep 12 at 12:37

                                  • Couldn’t you halve the labels by skipping to the next if statement if the condition is false? e.g. if i modulo-3 != 1 jump to next if else push NO
                                    – Jo King
                                    Sep 12 at 13:15

                                  • 1

                                    @JoKing Ah wait, I misunderstood a part of your pseudo-code. My first issue about not retrieving i before the if(i is 0) call PRINT is true, but your other is checking the i before subtracting it and skipping over the prints. Pretty smart actually. Will continue implementing it.
                                    – Kevin Cruijssen
                                    Sep 13 at 10:00

                                  • 1

                                    Well, if you jump to the start of the loop, it will run the if statement again and jump straight back to the print function. Maybe this saves a byte if you change the loop label to the empty label
                                    – Jo King
                                    Sep 13 at 12:40

                                  up vote
                                  13
                                  down vote

                                  Whitespace, 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 (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 “Yeahn”, “Butn”, “Non”). 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 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 that I’ve also used to golf another Whitespace answer of mine before. 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.

                                  share|improve this answer

                                  • 1

                                    I most certainly did not expect a Whitespace answer. Good job!
                                    – maxb
                                    Sep 12 at 12:31

                                  • @maxb Thanks! Unfortunately it’s quite a bit longer than expected due to the 8 labels it requires.. But I’m already happy it’s working. 🙂
                                    – Kevin Cruijssen
                                    Sep 12 at 12:37

                                  • Couldn’t you halve the labels by skipping to the next if statement if the condition is false? e.g. if i modulo-3 != 1 jump to next if else push NO
                                    – Jo King
                                    Sep 12 at 13:15

                                  • 1

                                    @JoKing Ah wait, I misunderstood a part of your pseudo-code. My first issue about not retrieving i before the if(i is 0) call PRINT is true, but your other is checking the i before subtracting it and skipping over the prints. Pretty smart actually. Will continue implementing it.
                                    – Kevin Cruijssen
                                    Sep 13 at 10:00

                                  • 1

                                    Well, if you jump to the start of the loop, it will run the if statement again and jump straight back to the print function. Maybe this saves a byte if you change the loop label to the empty label
                                    – Jo King
                                    Sep 13 at 12:40

                                  up vote
                                  13
                                  down vote

                                  up vote
                                  13
                                  down vote

                                  Whitespace, 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 (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 “Yeahn”, “Butn”, “Non”). 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 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 that I’ve also used to golf another Whitespace answer of mine before. 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.

                                  share|improve this answer

                                  Whitespace, 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 (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 “Yeahn”, “Butn”, “Non”). 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 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 that I’ve also used to golf another Whitespace answer of mine before. 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.

                                  share|improve this answer

                                  share|improve this answer

                                  share|improve this answer

                                  edited Sep 13 at 12:48

                                  answered Sep 12 at 12:28

                                  Kevin Cruijssen

                                  30.6k553167

                                  30.6k553167

                                  • 1

                                    I most certainly did not expect a Whitespace answer. Good job!
                                    – maxb
                                    Sep 12 at 12:31

                                  • @maxb Thanks! Unfortunately it’s quite a bit longer than expected due to the 8 labels it requires.. But I’m already happy it’s working. 🙂
                                    – Kevin Cruijssen
                                    Sep 12 at 12:37

                                  • Couldn’t you halve the labels by skipping to the next if statement if the condition is false? e.g. if i modulo-3 != 1 jump to next if else push NO
                                    – Jo King
                                    Sep 12 at 13:15

                                  • 1

                                    @JoKing Ah wait, I misunderstood a part of your pseudo-code. My first issue about not retrieving i before the if(i is 0) call PRINT is true, but your other is checking the i before subtracting it and skipping over the prints. Pretty smart actually. Will continue implementing it.
                                    – Kevin Cruijssen
                                    Sep 13 at 10:00

                                  • 1

                                    Well, if you jump to the start of the loop, it will run the if statement again and jump straight back to the print function. Maybe this saves a byte if you change the loop label to the empty label
                                    – Jo King
                                    Sep 13 at 12:40

                                  • 1

                                    I most certainly did not expect a Whitespace answer. Good job!
                                    – maxb
                                    Sep 12 at 12:31

                                  • @maxb Thanks! Unfortunately it’s quite a bit longer than expected due to the 8 labels it requires.. But I’m already happy it’s working. 🙂
                                    – Kevin Cruijssen
                                    Sep 12 at 12:37

                                  • Couldn’t you halve the labels by skipping to the next if statement if the condition is false? e.g. if i modulo-3 != 1 jump to next if else push NO
                                    – Jo King
                                    Sep 12 at 13:15

                                  • 1

                                    @JoKing Ah wait, I misunderstood a part of your pseudo-code. My first issue about not retrieving i before the if(i is 0) call PRINT is true, but your other is checking the i before subtracting it and skipping over the prints. Pretty smart actually. Will continue implementing it.
                                    – Kevin Cruijssen
                                    Sep 13 at 10:00

                                  • 1

                                    Well, if you jump to the start of the loop, it will run the if statement again and jump straight back to the print function. Maybe this saves a byte if you change the loop label to the empty label
                                    – Jo King
                                    Sep 13 at 12:40

                                  1

                                  1

                                  I most certainly did not expect a Whitespace answer. Good job!
                                  – maxb
                                  Sep 12 at 12:31

                                  I most certainly did not expect a Whitespace answer. Good job!
                                  – maxb
                                  Sep 12 at 12:31

                                  @maxb Thanks! Unfortunately it’s quite a bit longer than expected due to the 8 labels it requires.. But I’m already happy it’s working. 🙂
                                  – Kevin Cruijssen
                                  Sep 12 at 12:37

                                  @maxb Thanks! Unfortunately it’s quite a bit longer than expected due to the 8 labels it requires.. But I’m already happy it’s working. 🙂
                                  – Kevin Cruijssen
                                  Sep 12 at 12:37

                                  Couldn’t you halve the labels by skipping to the next if statement if the condition is false? e.g. if i modulo-3 != 1 jump to next if else push NO
                                  – Jo King
                                  Sep 12 at 13:15

                                  Couldn’t you halve the labels by skipping to the next if statement if the condition is false? e.g. if i modulo-3 != 1 jump to next if else push NO
                                  – Jo King
                                  Sep 12 at 13:15

                                  1

                                  1

                                  @JoKing Ah wait, I misunderstood a part of your pseudo-code. My first issue about not retrieving i before the if(i is 0) call PRINT is true, but your other is checking the i before subtracting it and skipping over the prints. Pretty smart actually. Will continue implementing it.
                                  – Kevin Cruijssen
                                  Sep 13 at 10:00

                                  @JoKing Ah wait, I misunderstood a part of your pseudo-code. My first issue about not retrieving i before the if(i is 0) call PRINT is true, but your other is checking the i before subtracting it and skipping over the prints. Pretty smart actually. Will continue implementing it.
                                  – Kevin Cruijssen
                                  Sep 13 at 10:00

                                  1

                                  1

                                  Well, if you jump to the start of the loop, it will run the if statement again and jump straight back to the print function. Maybe this saves a byte if you change the loop label to the empty label
                                  – Jo King
                                  Sep 13 at 12:40

                                  Well, if you jump to the start of the loop, it will run the if statement again and jump straight back to the print function. Maybe this saves a byte if you change the loop label to the empty label
                                  – Jo King
                                  Sep 13 at 12:40

                                  up vote
                                  11
                                  down vote

                                  Python 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!


                                  Python 3, 79 76 bytes

                                  Port of Keeta’s Excel answer.

                                  lambda n:(f"""Yeah
                                  But
                                  No      
                                  But     
                                  Yeah    
                                  But
                                  No{'':11}
                                  """*n)[:9*n]
                                  

                                  Try it online!

                                  share|improve this answer

                                    up vote
                                    11
                                    down vote

                                    Python 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!


                                    Python 3, 79 76 bytes

                                    Port of Keeta’s Excel answer.

                                    lambda n:(f"""Yeah
                                    But
                                    No      
                                    But     
                                    Yeah    
                                    But
                                    No{'':11}
                                    """*n)[:9*n]
                                    

                                    Try it online!

                                    share|improve this answer

                                      up vote
                                      11
                                      down vote

                                      up vote
                                      11
                                      down vote

                                      Python 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!


                                      Python 3, 79 76 bytes

                                      Port of Keeta’s Excel answer.

                                      lambda n:(f"""Yeah
                                      But
                                      No      
                                      But     
                                      Yeah    
                                      But
                                      No{'':11}
                                      """*n)[:9*n]
                                      

                                      Try it online!

                                      share|improve this answer

                                      Python 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!


                                      Python 3, 79 76 bytes

                                      Port of Keeta’s Excel answer.

                                      lambda n:(f"""Yeah
                                      But
                                      No      
                                      But     
                                      Yeah    
                                      But
                                      No{'':11}
                                      """*n)[:9*n]
                                      

                                      Try it online!

                                      share|improve this answer

                                      share|improve this answer

                                      share|improve this answer

                                      edited Sep 12 at 14:59

                                      answered Sep 12 at 12:25

                                      ovs

                                      17.5k21058

                                      17.5k21058

                                          up vote
                                          11
                                          down vote

                                          Perl 6, 63 50 bytes

                                          {<<"Yeah But"No But Yeah"But No">>[^$_ X%6].words}
                                          

                                          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
                                          

                                          share|improve this answer

                                            up vote
                                            11
                                            down vote

                                            Perl 6, 63 50 bytes

                                            {<<"Yeah But"No But Yeah"But No">>[^$_ X%6].words}
                                            

                                            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
                                            

                                            share|improve this answer

                                              up vote
                                              11
                                              down vote

                                              up vote
                                              11
                                              down vote

                                              Perl 6, 63 50 bytes

                                              {<<"Yeah But"No But Yeah"But No">>[^$_ X%6].words}
                                              

                                              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
                                              

                                              share|improve this answer

                                              Perl 6, 63 50 bytes

                                              {<<"Yeah But"No But Yeah"But No">>[^$_ X%6].words}
                                              

                                              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
                                              

                                              share|improve this answer

                                              share|improve this answer

                                              share|improve this answer

                                              edited Sep 13 at 3:19

                                              answered Sep 12 at 8:45

                                              Jo King

                                              16.5k24190

                                              16.5k24190

                                                  up vote
                                                  8
                                                  down vote

                                                  C (gcc), 75 bytes

                                                  f(o,_){for(_=0;o-_;_++%3-1||puts("No"))_%3||puts("Yeah"),1&_||puts("But");}
                                                  

                                                  Try it online!


                                                  C (gcc), 60 + 11 = 71 bytes (using -D$=||puts()

                                                  f(o,_){for(_=0;o-_;_++%3-1 $"No"))_%3 $"Yeah"),1&_ $"But");}
                                                  

                                                  Try it online!

                                                  share|improve this answer

                                                    up vote
                                                    8
                                                    down vote

                                                    C (gcc), 75 bytes

                                                    f(o,_){for(_=0;o-_;_++%3-1||puts("No"))_%3||puts("Yeah"),1&_||puts("But");}
                                                    

                                                    Try it online!


                                                    C (gcc), 60 + 11 = 71 bytes (using -D$=||puts()

                                                    f(o,_){for(_=0;o-_;_++%3-1 $"No"))_%3 $"Yeah"),1&_ $"But");}
                                                    

                                                    Try it online!

                                                    share|improve this answer

                                                      up vote
                                                      8
                                                      down vote

                                                      up vote
                                                      8
                                                      down vote

                                                      C (gcc), 75 bytes

                                                      f(o,_){for(_=0;o-_;_++%3-1||puts("No"))_%3||puts("Yeah"),1&_||puts("But");}
                                                      

                                                      Try it online!


                                                      C (gcc), 60 + 11 = 71 bytes (using -D$=||puts()

                                                      f(o,_){for(_=0;o-_;_++%3-1 $"No"))_%3 $"Yeah"),1&_ $"But");}
                                                      

                                                      Try it online!

                                                      share|improve this answer

                                                      C (gcc), 75 bytes

                                                      f(o,_){for(_=0;o-_;_++%3-1||puts("No"))_%3||puts("Yeah"),1&_||puts("But");}
                                                      

                                                      Try it online!


                                                      C (gcc), 60 + 11 = 71 bytes (using -D$=||puts()

                                                      f(o,_){for(_=0;o-_;_++%3-1 $"No"))_%3 $"Yeah"),1&_ $"But");}
                                                      

                                                      Try it online!

                                                      share|improve this answer

                                                      share|improve this answer

                                                      share|improve this answer

                                                      edited Sep 12 at 9:01

                                                      answered Sep 12 at 8:21

                                                      Jonathan Frech

                                                      6,06311040

                                                      6,06311040

                                                          up vote
                                                          8
                                                          down vote

                                                          05AB1E (legacy), 27 25 24 bytes

                                                          Saved 1 byte thanks to Kevin Cruijssen.

                                                          F”¥æ€³€¸”#N3ÖNÈN3%‚‚˜Ï`»
                                                          

                                                          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
                                                          

                                                          share|improve this answer

                                                          • Dang, you beat me to it.. Was about to post an answer. Yours is shorter anyway, so +1 from me.. Nice use of ×, hadn’t thought about that!
                                                            – Kevin Cruijssen
                                                            Sep 12 at 8:27

                                                          • Wow, I’d love an explanation on this one. My personal best was 44 bytes in CJam.
                                                            – maxb
                                                            Sep 12 at 8:29

                                                          • @maxb: I will of course add an explanation. I’m just checking to see if I can golf it down some more first 😉
                                                            – Emigna
                                                            Sep 12 at 8:30

                                                          • You can remove the Θ now that you’re no longer using ×, since Ï will only look at 1s only, so it ignores the 2 (and 0 of course).
                                                            – Kevin Cruijssen
                                                            Sep 12 at 9:32

                                                          • @KevinCruijssen: Thanks! Not sure how I missed that 😛
                                                            – Emigna
                                                            Sep 12 at 9:51

                                                          up vote
                                                          8
                                                          down vote

                                                          05AB1E (legacy), 27 25 24 bytes

                                                          Saved 1 byte thanks to Kevin Cruijssen.

                                                          F”¥æ€³€¸”#N3ÖNÈN3%‚‚˜Ï`»
                                                          

                                                          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
                                                          

                                                          share|improve this answer

                                                          • Dang, you beat me to it.. Was about to post an answer. Yours is shorter anyway, so +1 from me.. Nice use of ×, hadn’t thought about that!
                                                            – Kevin Cruijssen
                                                            Sep 12 at 8:27

                                                          • Wow, I’d love an explanation on this one. My personal best was 44 bytes in CJam.
                                                            – maxb
                                                            Sep 12 at 8:29

                                                          • @maxb: I will of course add an explanation. I’m just checking to see if I can golf it down some more first 😉
                                                            – Emigna
                                                            Sep 12 at 8:30

                                                          • You can remove the Θ now that you’re no longer using ×, since Ï will only look at 1s only, so it ignores the 2 (and 0 of course).
                                                            – Kevin Cruijssen
                                                            Sep 12 at 9:32

                                                          • @KevinCruijssen: Thanks! Not sure how I missed that 😛
                                                            – Emigna
                                                            Sep 12 at 9:51

                                                          up vote
                                                          8
                                                          down vote

                                                          up vote
                                                          8
                                                          down vote

                                                          05AB1E (legacy), 27 25 24 bytes

                                                          Saved 1 byte thanks to Kevin Cruijssen.

                                                          F”¥æ€³€¸”#N3ÖNÈN3%‚‚˜Ï`»
                                                          

                                                          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
                                                          

                                                          share|improve this answer

                                                          05AB1E (legacy), 27 25 24 bytes

                                                          Saved 1 byte thanks to Kevin Cruijssen.

                                                          F”¥æ€³€¸”#N3ÖNÈN3%‚‚˜Ï`»
                                                          

                                                          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
                                                          

                                                          share|improve this answer

                                                          share|improve this answer

                                                          share|improve this answer

                                                          edited Sep 12 at 9:51

                                                          answered Sep 12 at 8:22

                                                          Emigna

                                                          43.4k431131

                                                          43.4k431131

                                                          • Dang, you beat me to it.. Was about to post an answer. Yours is shorter anyway, so +1 from me.. Nice use of ×, hadn’t thought about that!
                                                            – Kevin Cruijssen
                                                            Sep 12 at 8:27

                                                          • Wow, I’d love an explanation on this one. My personal best was 44 bytes in CJam.
                                                            – maxb
                                                            Sep 12 at 8:29

                                                          • @maxb: I will of course add an explanation. I’m just checking to see if I can golf it down some more first 😉
                                                            – Emigna
                                                            Sep 12 at 8:30

                                                          • You can remove the Θ now that you’re no longer using ×, since Ï will only look at 1s only, so it ignores the 2 (and 0 of course).
                                                            – Kevin Cruijssen
                                                            Sep 12 at 9:32

                                                          • @KevinCruijssen: Thanks! Not sure how I missed that 😛
                                                            – Emigna
                                                            Sep 12 at 9:51

                                                          • Dang, you beat me to it.. Was about to post an answer. Yours is shorter anyway, so +1 from me.. Nice use of ×, hadn’t thought about that!
                                                            – Kevin Cruijssen
                                                            Sep 12 at 8:27

                                                          • Wow, I’d love an explanation on this one. My personal best was 44 bytes in CJam.
                                                            – maxb
                                                            Sep 12 at 8:29

                                                          • @maxb: I will of course add an explanation. I’m just checking to see if I can golf it down some more first 😉
                                                            – Emigna
                                                            Sep 12 at 8:30

                                                          • You can remove the Θ now that you’re no longer using ×, since Ï will only look at 1s only, so it ignores the 2 (and 0 of course).
                                                            – Kevin Cruijssen
                                                            Sep 12 at 9:32

                                                          • @KevinCruijssen: Thanks! Not sure how I missed that 😛
                                                            – Emigna
                                                            Sep 12 at 9:51

                                                          Dang, you beat me to it.. Was about to post an answer. Yours is shorter anyway, so +1 from me.. Nice use of ×, hadn’t thought about that!
                                                          – Kevin Cruijssen
                                                          Sep 12 at 8:27

                                                          Dang, you beat me to it.. Was about to post an answer. Yours is shorter anyway, so +1 from me.. Nice use of ×, hadn’t thought about that!
                                                          – Kevin Cruijssen
                                                          Sep 12 at 8:27

                                                          Wow, I’d love an explanation on this one. My personal best was 44 bytes in CJam.
                                                          – maxb
                                                          Sep 12 at 8:29

                                                          Wow, I’d love an explanation on this one. My personal best was 44 bytes in CJam.
                                                          – maxb
                                                          Sep 12 at 8:29

                                                          @maxb: I will of course add an explanation. I’m just checking to see if I can golf it down some more first 😉
                                                          – Emigna
                                                          Sep 12 at 8:30

                                                          @maxb: I will of course add an explanation. I’m just checking to see if I can golf it down some more first 😉
                                                          – Emigna
                                                          Sep 12 at 8:30

                                                          You can remove the Θ now that you’re no longer using ×, since Ï will only look at 1s only, so it ignores the 2 (and 0 of course).
                                                          – Kevin Cruijssen
                                                          Sep 12 at 9:32

                                                          You can remove the Θ now that you’re no longer using ×, since Ï will only look at 1s only, so it ignores the 2 (and 0 of course).
                                                          – Kevin Cruijssen
                                                          Sep 12 at 9:32

                                                          @KevinCruijssen: Thanks! Not sure how I missed that 😛
                                                          – Emigna
                                                          Sep 12 at 9:51

                                                          @KevinCruijssen: Thanks! Not sure how I missed that 😛
                                                          – Emigna
                                                          Sep 12 at 9:51

                                                          up vote
                                                          7
                                                          down vote

                                                          Python 2, 73 bytes

                                                          lambda n:'n'.join((["YeahnBut","No","But","Yeah","ButnNo"]*n)[:n-n/6])
                                                          

                                                          Try it online!

                                                          share|improve this answer

                                                            up vote
                                                            7
                                                            down vote

                                                            Python 2, 73 bytes

                                                            lambda n:'n'.join((["YeahnBut","No","But","Yeah","ButnNo"]*n)[:n-n/6])
                                                            

                                                            Try it online!

                                                            share|improve this answer

                                                              up vote
                                                              7
                                                              down vote

                                                              up vote
                                                              7
                                                              down vote

                                                              Python 2, 73 bytes

                                                              lambda n:'n'.join((["YeahnBut","No","But","Yeah","ButnNo"]*n)[:n-n/6])
                                                              

                                                              Try it online!

                                                              share|improve this answer

                                                              Python 2, 73 bytes

                                                              lambda n:'n'.join((["YeahnBut","No","But","Yeah","ButnNo"]*n)[:n-n/6])
                                                              

                                                              Try it online!

                                                              share|improve this answer

                                                              share|improve this answer

                                                              share|improve this answer

                                                              edited Sep 12 at 15:15

                                                              answered Sep 12 at 14:56

                                                              Lynn

                                                              48.1k694223

                                                              48.1k694223

                                                                  up vote
                                                                  6
                                                                  down vote

                                                                  Python 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!

                                                                  -2 bytes, thanks to ovs


                                                                  Python 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!

                                                                  -4 bytes, thanks to ovs

                                                                  -4 bytes, thanks to Jo King

                                                                  share|improve this answer

                                                                  • 86 bytes by combining the two and returning as a list of lines
                                                                    – Jo King
                                                                    Sep 12 at 13:09

                                                                  • @JoKing Thanks, didn’t know that I could return instead of printing when wrote it.
                                                                    – TFeld
                                                                    Sep 12 at 13:14

                                                                  • 82 bytes: len(w)<3 -> 'N'in w, 81 bytes : len(w)%2 -> (w<'N')
                                                                    – ovs
                                                                    Sep 12 at 13:22

                                                                  • @ovs Thanks, 🙂
                                                                    – TFeld
                                                                    Sep 12 at 13:27

                                                                  up vote
                                                                  6
                                                                  down vote

                                                                  Python 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!

                                                                  -2 bytes, thanks to ovs


                                                                  Python 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!

                                                                  -4 bytes, thanks to ovs

                                                                  -4 bytes, thanks to Jo King

                                                                  share|improve this answer

                                                                  • 86 bytes by combining the two and returning as a list of lines
                                                                    – Jo King
                                                                    Sep 12 at 13:09

                                                                  • @JoKing Thanks, didn’t know that I could return instead of printing when wrote it.
                                                                    – TFeld
                                                                    Sep 12 at 13:14

                                                                  • 82 bytes: len(w)<3 -> 'N'in w, 81 bytes : len(w)%2 -> (w<'N')
                                                                    – ovs
                                                                    Sep 12 at 13:22

                                                                  • @ovs Thanks, 🙂
                                                                    – TFeld
                                                                    Sep 12 at 13:27

                                                                  up vote
                                                                  6
                                                                  down vote

                                                                  up vote
                                                                  6
                                                                  down vote

                                                                  Python 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!

                                                                  -2 bytes, thanks to ovs


                                                                  Python 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!

                                                                  -4 bytes, thanks to ovs

                                                                  -4 bytes, thanks to Jo King

                                                                  share|improve this answer

                                                                  Python 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!

                                                                  -2 bytes, thanks to ovs


                                                                  Python 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!

                                                                  -4 bytes, thanks to ovs

                                                                  -4 bytes, thanks to Jo King

                                                                  share|improve this answer

                                                                  share|improve this answer

                                                                  share|improve this answer

                                                                  edited Sep 12 at 13:27

                                                                  answered Sep 12 at 8:09

                                                                  TFeld

                                                                  11.9k2833

                                                                  11.9k2833

                                                                  • 86 bytes by combining the two and returning as a list of lines
                                                                    – Jo King
                                                                    Sep 12 at 13:09

                                                                  • @JoKing Thanks, didn’t know that I could return instead of printing when wrote it.
                                                                    – TFeld
                                                                    Sep 12 at 13:14

                                                                  • 82 bytes: len(w)<3 -> 'N'in w, 81 bytes : len(w)%2 -> (w<'N')
                                                                    – ovs
                                                                    Sep 12 at 13:22

                                                                  • @ovs Thanks, 🙂
                                                                    – TFeld
                                                                    Sep 12 at 13:27

                                                                  • 86 bytes by combining the two and returning as a list of lines
                                                                    – Jo King
                                                                    Sep 12 at 13:09

                                                                  • @JoKing Thanks, didn’t know that I could return instead of printing when wrote it.
                                                                    – TFeld
                                                                    Sep 12 at 13:14

                                                                  • 82 bytes: len(w)<3 -> 'N'in w, 81 bytes : len(w)%2 -> (w<'N')
                                                                    – ovs
                                                                    Sep 12 at 13:22

                                                                  • @ovs Thanks, 🙂
                                                                    – TFeld
                                                                    Sep 12 at 13:27

                                                                  86 bytes by combining the two and returning as a list of lines
                                                                  – Jo King
                                                                  Sep 12 at 13:09

                                                                  86 bytes by combining the two and returning as a list of lines
                                                                  – Jo King
                                                                  Sep 12 at 13:09

                                                                  @JoKing Thanks, didn’t know that I could return instead of printing when wrote it.
                                                                  – TFeld
                                                                  Sep 12 at 13:14

                                                                  @JoKing Thanks, didn’t know that I could return instead of printing when wrote it.
                                                                  – TFeld
                                                                  Sep 12 at 13:14

                                                                  82 bytes: len(w)<3 -> 'N'in w, 81 bytes : len(w)%2 -> (w<'N')
                                                                  – ovs
                                                                  Sep 12 at 13:22

                                                                  82 bytes: len(w)<3 -> 'N'in w, 81 bytes : len(w)%2 -> (w<'N')
                                                                  – ovs
                                                                  Sep 12 at 13:22

                                                                  @ovs Thanks, 🙂
                                                                  – TFeld
                                                                  Sep 12 at 13:27

                                                                  @ovs Thanks, 🙂
                                                                  – TFeld
                                                                  Sep 12 at 13:27

                                                                  up vote
                                                                  6
                                                                  down vote

                                                                  Groovy (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?'':'Yeahn')+(n%2?'':'Butn')+(n%3==1?'Non':''):''}
                                                                  

                                                                  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!

                                                                  Groovy (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?'':'Yeahn')+(it%2?'':'Butn')+(it%3==1?'Non':''))}
                                                                  

                                                                  Try it online!

                                                                  share|improve this answer

                                                                  • Welcome to PPCG! Great first answer! I haven’t coded any Groovy myself, but might I suggest running your code on TIO? That way, it can be validated by others, and enjoyed by all.
                                                                    – maxb
                                                                    Sep 12 at 15:20

                                                                  • 1

                                                                    @maxb Thanks! I’ve added one 🙂
                                                                    – archangel.mjj
                                                                    Sep 12 at 15:29

                                                                  • Nice first answer and also welcome to PPCG.
                                                                    – ElPedro
                                                                    Sep 12 at 18:03

                                                                  up vote
                                                                  6
                                                                  down vote

                                                                  Groovy (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?'':'Yeahn')+(n%2?'':'Butn')+(n%3==1?'Non':''):''}
                                                                  

                                                                  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!

                                                                  Groovy (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?'':'Yeahn')+(it%2?'':'Butn')+(it%3==1?'Non':''))}
                                                                  

                                                                  Try it online!

                                                                  share|improve this answer

                                                                  • Welcome to PPCG! Great first answer! I haven’t coded any Groovy myself, but might I suggest running your code on TIO? That way, it can be validated by others, and enjoyed by all.
                                                                    – maxb
                                                                    Sep 12 at 15:20

                                                                  • 1

                                                                    @maxb Thanks! I’ve added one 🙂
                                                                    – archangel.mjj
                                                                    Sep 12 at 15:29

                                                                  • Nice first answer and also welcome to PPCG.
                                                                    – ElPedro
                                                                    Sep 12 at 18:03

                                                                  up vote
                                                                  6
                                                                  down vote

                                                                  up vote
                                                                  6
                                                                  down vote

                                                                  Groovy (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?'':'Yeahn')+(n%2?'':'Butn')+(n%3==1?'Non':''):''}
                                                                  

                                                                  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!

                                                                  Groovy (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?'':'Yeahn')+(it%2?'':'Butn')+(it%3==1?'Non':''))}
                                                                  

                                                                  Try it online!

                                                                  share|improve this answer

                                                                  Groovy (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?'':'Yeahn')+(n%2?'':'Butn')+(n%3==1?'Non':''):''}
                                                                  

                                                                  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!

                                                                  Groovy (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?'':'Yeahn')+(it%2?'':'Butn')+(it%3==1?'Non':''))}
                                                                  

                                                                  Try it online!

                                                                  share|improve this answer

                                                                  share|improve this answer

                                                                  share|improve this answer

                                                                  edited Sep 14 at 12:38

                                                                  answered Sep 12 at 15:13

                                                                  archangel.mjj

                                                                  813

                                                                  813

                                                                  • Welcome to PPCG! Great first answer! I haven’t coded any Groovy myself, but might I suggest running your code on TIO? That way, it can be validated by others, and enjoyed by all.
                                                                    – maxb
                                                                    Sep 12 at 15:20

                                                                  • 1

                                                                    @maxb Thanks! I’ve added one 🙂
                                                                    – archangel.mjj
                                                                    Sep 12 at 15:29

                                                                  • Nice first answer and also welcome to PPCG.
                                                                    – ElPedro
                                                                    Sep 12 at 18:03

                                                                  • Welcome to PPCG! Great first answer! I haven’t coded any Groovy myself, but might I suggest running your code on TIO? That way, it can be validated by others, and enjoyed by all.
                                                                    – maxb
                                                                    Sep 12 at 15:20

                                                                  • 1

                                                                    @maxb Thanks! I’ve added one 🙂
                                                                    – archangel.mjj
                                                                    Sep 12 at 15:29

                                                                  • Nice first answer and also welcome to PPCG.
                                                                    – ElPedro
                                                                    Sep 12 at 18:03

                                                                  Welcome to PPCG! Great first answer! I haven’t coded any Groovy myself, but might I suggest running your code on TIO? That way, it can be validated by others, and enjoyed by all.
                                                                  – maxb
                                                                  Sep 12 at 15:20

                                                                  Welcome to PPCG! Great first answer! I haven’t coded any Groovy myself, but might I suggest running your code on TIO? That way, it can be validated by others, and enjoyed by all.
                                                                  – maxb
                                                                  Sep 12 at 15:20

                                                                  1

                                                                  1

                                                                  @maxb Thanks! I’ve added one 🙂
                                                                  – archangel.mjj
                                                                  Sep 12 at 15:29

                                                                  @maxb Thanks! I’ve added one 🙂
                                                                  – archangel.mjj
                                                                  Sep 12 at 15:29

                                                                  Nice first answer and also welcome to PPCG.
                                                                  – ElPedro
                                                                  Sep 12 at 18:03

                                                                  Nice first answer and also welcome to PPCG.
                                                                  – ElPedro
                                                                  Sep 12 at 18:03

                                                                  up vote
                                                                  5
                                                                  down vote

                                                                  Retina 0.8.2, 45 bytes

                                                                  .+
                                                                  $*
                                                                  1
                                                                  $`Yeah¶$`But¶$`11No¶
                                                                  +`11B
                                                                  B
                                                                  111
                                                                  
                                                                  A`1
                                                                  

                                                                  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 1s before it, except for No, which has two extra 1s so that we calculate (i+2)%3==0 which is equivalent to i%3==1.

                                                                  +`11B
                                                                  B
                                                                  

                                                                  Remove pairs of 1s before Bs.

                                                                  111
                                                                  

                                                                  Remove 1s in groups of three everywhere else.

                                                                  A`1
                                                                  

                                                                  Delete all lines that still have a 1.

                                                                  share|improve this answer

                                                                  • Oh, now that I see 11No¶ to calculate (i+2)%3==0 (so all three are if-checks for ==0) it looks so obvious, but I wouldn’t have thought of that myself, so it’s actually quite ingenious. +1 from me, nice answer!
                                                                    – Kevin Cruijssen
                                                                    Sep 12 at 12:51

                                                                  up vote
                                                                  5
                                                                  down vote

                                                                  Retina 0.8.2, 45 bytes

                                                                  .+
                                                                  $*
                                                                  1
                                                                  $`Yeah¶$`But¶$`11No¶
                                                                  +`11B
                                                                  B
                                                                  111
                                                                  
                                                                  A`1
                                                                  

                                                                  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 1s before it, except for No, which has two extra 1s so that we calculate (i+2)%3==0 which is equivalent to i%3==1.

                                                                  +`11B
                                                                  B
                                                                  

                                                                  Remove pairs of 1s before Bs.

                                                                  111
                                                                  

                                                                  Remove 1s in groups of three everywhere else.

                                                                  A`1
                                                                  

                                                                  Delete all lines that still have a 1.

                                                                  share|improve this answer

                                                                  • Oh, now that I see 11No¶ to calculate (i+2)%3==0 (so all three are if-checks for ==0) it looks so obvious, but I wouldn’t have thought of that myself, so it’s actually quite ingenious. +1 from me, nice answer!
                                                                    – Kevin Cruijssen
                                                                    Sep 12 at 12:51

                                                                  up vote
                                                                  5
                                                                  down vote

                                                                  up vote
                                                                  5
                                                                  down vote

                                                                  Retina 0.8.2, 45 bytes

                                                                  .+
                                                                  $*
                                                                  1
                                                                  $`Yeah¶$`But¶$`11No¶
                                                                  +`11B
                                                                  B
                                                                  111
                                                                  
                                                                  A`1
                                                                  

                                                                  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 1s before it, except for No, which has two extra 1s so that we calculate (i+2)%3==0 which is equivalent to i%3==1.

                                                                  +`11B
                                                                  B
                                                                  

                                                                  Remove pairs of 1s before Bs.

                                                                  111
                                                                  

                                                                  Remove 1s in groups of three everywhere else.

                                                                  A`1
                                                                  

                                                                  Delete all lines that still have a 1.

                                                                  share|improve this answer

                                                                  Retina 0.8.2, 45 bytes

                                                                  .+
                                                                  $*
                                                                  1
                                                                  $`Yeah¶$`But¶$`11No¶
                                                                  +`11B
                                                                  B
                                                                  111
                                                                  
                                                                  A`1
                                                                  

                                                                  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 1s before it, except for No, which has two extra 1s so that we calculate (i+2)%3==0 which is equivalent to i%3==1.

                                                                  +`11B
                                                                  B
                                                                  

                                                                  Remove pairs of 1s before Bs.

                                                                  111
                                                                  

                                                                  Remove 1s in groups of three everywhere else.

                                                                  A`1
                                                                  

                                                                  Delete all lines that still have a 1.

                                                                  share|improve this answer

                                                                  share|improve this answer

                                                                  share|improve this answer

                                                                  answered Sep 12 at 11:01

                                                                  Neil

                                                                  75.8k744171

                                                                  75.8k744171

                                                                  • Oh, now that I see 11No¶ to calculate (i+2)%3==0 (so all three are if-checks for ==0) it looks so obvious, but I wouldn’t have thought of that myself, so it’s actually quite ingenious. +1 from me, nice answer!
                                                                    – Kevin Cruijssen
                                                                    Sep 12 at 12:51

                                                                  • Oh, now that I see 11No¶ to calculate (i+2)%3==0 (so all three are if-checks for ==0) it looks so obvious, but I wouldn’t have thought of that myself, so it’s actually quite ingenious. +1 from me, nice answer!
                                                                    – Kevin Cruijssen
                                                                    Sep 12 at 12:51

                                                                  Oh, now that I see 11No¶ to calculate (i+2)%3==0 (so all three are if-checks for ==0) it looks so obvious, but I wouldn’t have thought of that myself, so it’s actually quite ingenious. +1 from me, nice answer!
                                                                  – Kevin Cruijssen
                                                                  Sep 12 at 12:51

                                                                  Oh, now that I see 11No¶ to calculate (i+2)%3==0 (so all three are if-checks for ==0) it looks so obvious, but I wouldn’t have thought of that myself, so it’s actually quite ingenious. +1 from me, nice answer!
                                                                  – Kevin Cruijssen
                                                                  Sep 12 at 12:51

                                                                  up vote
                                                                  5
                                                                  down vote

                                                                  Canvas, 27 bytes

                                                                  {╷⌐3%‽YeahP}2%‽ButP}3%╷‽NoP
                                                                  

                                                                  Try it here!

                                                                  share|improve this answer

                                                                    up vote
                                                                    5
                                                                    down vote

                                                                    Canvas, 27 bytes

                                                                    {╷⌐3%‽YeahP}2%‽ButP}3%╷‽NoP
                                                                    

                                                                    Try it here!

                                                                    share|improve this answer

                                                                      up vote
                                                                      5
                                                                      down vote

                                                                      up vote
                                                                      5
                                                                      down vote

                                                                      Canvas, 27 bytes

                                                                      {╷⌐3%‽YeahP}2%‽ButP}3%╷‽NoP
                                                                      

                                                                      Try it here!

                                                                      share|improve this answer

                                                                      Canvas, 27 bytes

                                                                      {╷⌐3%‽YeahP}2%‽ButP}3%╷‽NoP
                                                                      

                                                                      Try it here!

                                                                      share|improve this answer

                                                                      share|improve this answer

                                                                      share|improve this answer

                                                                      answered Sep 12 at 14:59

                                                                      dzaima

                                                                      13.1k21652

                                                                      13.1k21652

                                                                          up vote
                                                                          5
                                                                          down vote

                                                                          Java 10, 100 99 bytes

                                                                          n->{for(int i=0;i<n;)System.out.print((i%3<1?"Yeahn":"")+(i%2<1?"Butn":"")+(++i%3>1?"Non":""));}
                                                                          

                                                                          -1 byte thanks to @OlivierGrégoire.

                                                                          Try it online.

                                                                          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:
                                                                                  "Yeahn"       //     Print "Yeah" with newline
                                                                                :"")+(i%2<1?     //    If `i` is even:
                                                                                  "Butn"        //     Print "But" with newline
                                                                                :"")+(++i%3>1?   //    If `i` modulo-3 is 1:
                                                                                  "Non"         //     Print "No" with newline
                                                                                :                //    If none of the above three if's applied to the current `i`:
                                                                                 ""));}          //     Print nothing for the current `i`
                                                                          

                                                                          share|improve this answer

                                                                          • 1

                                                                            ++i%3>1 will likely save you a byte
                                                                            – Olivier Grégoire
                                                                            Sep 12 at 22:56

                                                                          • @OlivierGrégoire Ah, of course. Thanks!
                                                                            – Kevin Cruijssen
                                                                            Sep 13 at 7:40

                                                                          up vote
                                                                          5
                                                                          down vote

                                                                          Java 10, 100 99 bytes

                                                                          n->{for(int i=0;i<n;)System.out.print((i%3<1?"Yeahn":"")+(i%2<1?"Butn":"")+(++i%3>1?"Non":""));}
                                                                          

                                                                          -1 byte thanks to @OlivierGrégoire.

                                                                          Try it online.

                                                                          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:
                                                                                  "Yeahn"       //     Print "Yeah" with newline
                                                                                :"")+(i%2<1?     //    If `i` is even:
                                                                                  "Butn"        //     Print "But" with newline
                                                                                :"")+(++i%3>1?   //    If `i` modulo-3 is 1:
                                                                                  "Non"         //     Print "No" with newline
                                                                                :                //    If none of the above three if's applied to the current `i`:
                                                                                 ""));}          //     Print nothing for the current `i`
                                                                          

                                                                          share|improve this answer

                                                                          • 1

                                                                            ++i%3>1 will likely save you a byte
                                                                            – Olivier Grégoire
                                                                            Sep 12 at 22:56

                                                                          • @OlivierGrégoire Ah, of course. Thanks!
                                                                            – Kevin Cruijssen
                                                                            Sep 13 at 7:40

                                                                          up vote
                                                                          5
                                                                          down vote

                                                                          up vote
                                                                          5
                                                                          down vote

                                                                          Java 10, 100 99 bytes

                                                                          n->{for(int i=0;i<n;)System.out.print((i%3<1?"Yeahn":"")+(i%2<1?"Butn":"")+(++i%3>1?"Non":""));}
                                                                          

                                                                          -1 byte thanks to @OlivierGrégoire.

                                                                          Try it online.

                                                                          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:
                                                                                  "Yeahn"       //     Print "Yeah" with newline
                                                                                :"")+(i%2<1?     //    If `i` is even:
                                                                                  "Butn"        //     Print "But" with newline
                                                                                :"")+(++i%3>1?   //    If `i` modulo-3 is 1:
                                                                                  "Non"         //     Print "No" with newline
                                                                                :                //    If none of the above three if's applied to the current `i`:
                                                                                 ""));}          //     Print nothing for the current `i`
                                                                          

                                                                          share|improve this answer

                                                                          Java 10, 100 99 bytes

                                                                          n->{for(int i=0;i<n;)System.out.print((i%3<1?"Yeahn":"")+(i%2<1?"Butn":"")+(++i%3>1?"Non":""));}
                                                                          

                                                                          -1 byte thanks to @OlivierGrégoire.

                                                                          Try it online.

                                                                          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:
                                                                                  "Yeahn"       //     Print "Yeah" with newline
                                                                                :"")+(i%2<1?     //    If `i` is even:
                                                                                  "Butn"        //     Print "But" with newline
                                                                                :"")+(++i%3>1?   //    If `i` modulo-3 is 1:
                                                                                  "Non"         //     Print "No" with newline
                                                                                :                //    If none of the above three if's applied to the current `i`:
                                                                                 ""));}          //     Print nothing for the current `i`
                                                                          

                                                                          share|improve this answer

                                                                          share|improve this answer

                                                                          share|improve this answer

                                                                          edited Sep 13 at 7:39

                                                                          answered Sep 12 at 8:36

                                                                          Kevin Cruijssen

                                                                          30.6k553167

                                                                          30.6k553167

                                                                          • 1

                                                                            ++i%3>1 will likely save you a byte
                                                                            – Olivier Grégoire
                                                                            Sep 12 at 22:56

                                                                          • @OlivierGrégoire Ah, of course. Thanks!
                                                                            – Kevin Cruijssen
                                                                            Sep 13 at 7:40

                                                                          • 1

                                                                            ++i%3>1 will likely save you a byte
                                                                            – Olivier Grégoire
                                                                            Sep 12 at 22:56

                                                                          • @OlivierGrégoire Ah, of course. Thanks!
                                                                            – Kevin Cruijssen
                                                                            Sep 13 at 7:40

                                                                          1

                                                                          1

                                                                          ++i%3>1 will likely save you a byte
                                                                          – Olivier Grégoire
                                                                          Sep 12 at 22:56

                                                                          ++i%3>1 will likely save you a byte
                                                                          – Olivier Grégoire
                                                                          Sep 12 at 22:56

                                                                          @OlivierGrégoire Ah, of course. Thanks!
                                                                          – Kevin Cruijssen
                                                                          Sep 13 at 7:40

                                                                          @OlivierGrégoire Ah, of course. Thanks!
                                                                          – Kevin Cruijssen
                                                                          Sep 13 at 7:40

                                                                          up vote
                                                                          5
                                                                          down vote

                                                                          Powershell, 75 74 72 67 66 bytes

                                                                          -1 byte thanks 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]}}
                                                                          

                                                                          share|improve this answer

                                                                          • 1

                                                                            Great answer! Would it be possible to add some output to the answer, since it doesn’t include an online interpreter?
                                                                            – maxb
                                                                            Sep 12 at 13:36

                                                                          • The answer scriptblock does not return ======. It generates Yeah,But,No strings only. The test script shows a separator for easier reading of the results only.
                                                                            – mazzy
                                                                            Sep 12 at 14:10

                                                                          • That hashtable usage is clever. I’m going to need to remember that.
                                                                            – AdmBorkBork
                                                                            Sep 12 at 18:35

                                                                          • @maxb – a tio.run online interpreter link for the 67 byte answer
                                                                            – TessellatingHeckler
                                                                            Sep 17 at 5:07

                                                                          • 1

                                                                            @mazzy I can reformulate yours, but still can’t beat 67 (replace the two n with real newlines) (" YeahnBut No But Yeah ButnNo "*($j="$args")|% s*t 32)[1..$j]-ne''
                                                                            – TessellatingHeckler
                                                                            Sep 17 at 5:49

                                                                          up vote
                                                                          5
                                                                          down vote

                                                                          Powershell, 75 74 72 67 66 bytes

                                                                          -1 byte thanks 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]}}
                                                                          

                                                                          share|improve this answer

                                                                          • 1

                                                                            Great answer! Would it be possible to add some output to the answer, since it doesn’t include an online interpreter?
                                                                            – maxb
                                                                            Sep 12 at 13:36

                                                                          • The answer scriptblock does not return ======. It generates Yeah,But,No strings only. The test script shows a separator for easier reading of the results only.
                                                                            – mazzy
                                                                            Sep 12 at 14:10

                                                                          • That hashtable usage is clever. I’m going to need to remember that.
                                                                            – AdmBorkBork
                                                                            Sep 12 at 18:35

                                                                          • @maxb – a tio.run online interpreter link for the 67 byte answer
                                                                            – TessellatingHeckler
                                                                            Sep 17 at 5:07

                                                                          • 1

                                                                            @mazzy I can reformulate yours, but still can’t beat 67 (replace the two n with real newlines) (" YeahnBut No But Yeah ButnNo "*($j="$args")|% s*t 32)[1..$j]-ne''
                                                                            – TessellatingHeckler
                                                                            Sep 17 at 5:49

                                                                          up vote
                                                                          5
                                                                          down vote

                                                                          up vote
                                                                          5
                                                                          down vote

                                                                          Powershell, 75 74 72 67 66 bytes

                                                                          -1 byte thanks 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]}}
                                                                          

                                                                          share|improve this answer

                                                                          Powershell, 75 74 72 67 66 bytes

                                                                          -1 byte thanks 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]}}
                                                                          

                                                                          share|improve this answer

                                                                          share|improve this answer

                                                                          share|improve this answer

                                                                          edited Sep 17 at 8:40

                                                                          answered Sep 12 at 13:33

                                                                          mazzy

                                                                          86639

                                                                          86639

                                                                          • 1

                                                                            Great answer! Would it be possible to add some output to the answer, since it doesn’t include an online interpreter?
                                                                            – maxb
                                                                            Sep 12 at 13:36

                                                                          • The answer scriptblock does not return ======. It generates Yeah,But,No strings only. The test script shows a separator for easier reading of the results only.
                                                                            – mazzy
                                                                            Sep 12 at 14:10

                                                                          • That hashtable usage is clever. I’m going to need to remember that.
                                                                            – AdmBorkBork
                                                                            Sep 12 at 18:35

                                                                          • @maxb – a tio.run online interpreter link for the 67 byte answer
                                                                            – TessellatingHeckler
                                                                            Sep 17 at 5:07

                                                                          • 1

                                                                            @mazzy I can reformulate yours, but still can’t beat 67 (replace the two n with real newlines) (" YeahnBut No But Yeah ButnNo "*($j="$args")|% s*t 32)[1..$j]-ne''
                                                                            – TessellatingHeckler
                                                                            Sep 17 at 5:49

                                                                          • 1

                                                                            Great answer! Would it be possible to add some output to the answer, since it doesn’t include an online interpreter?
                                                                            – maxb
                                                                            Sep 12 at 13:36

                                                                          • The answer scriptblock does not return ======. It generates Yeah,But,No strings only. The test script shows a separator for easier reading of the results only.
                                                                            – mazzy
                                                                            Sep 12 at 14:10

                                                                          • That hashtable usage is clever. I’m going to need to remember that.
                                                                            – AdmBorkBork
                                                                            Sep 12 at 18:35

                                                                          • @maxb – a tio.run online interpreter link for the 67 byte answer
                                                                            – TessellatingHeckler
                                                                            Sep 17 at 5:07

                                                                          • 1

                                                                            @mazzy I can reformulate yours, but still can’t beat 67 (replace the two n with real newlines) (" YeahnBut No But Yeah ButnNo "*($j="$args")|% s*t 32)[1..$j]-ne''
                                                                            – TessellatingHeckler
                                                                            Sep 17 at 5:49

                                                                          1

                                                                          1

                                                                          Great answer! Would it be possible to add some output to the answer, since it doesn’t include an online interpreter?
                                                                          – maxb
                                                                          Sep 12 at 13:36

                                                                          Great answer! Would it be possible to add some output to the answer, since it doesn’t include an online interpreter?
                                                                          – maxb
                                                                          Sep 12 at 13:36

                                                                          The answer scriptblock does not return ======. It generates Yeah,But,No strings only. The test script shows a separator for easier reading of the results only.
                                                                          – mazzy
                                                                          Sep 12 at 14:10

                                                                          The answer scriptblock does not return ======. It generates Yeah,But,No strings only. The test script shows a separator for easier reading of the results only.
                                                                          – mazzy
                                                                          Sep 12 at 14:10

                                                                          That hashtable usage is clever. I’m going to need to remember that.
                                                                          – AdmBorkBork
                                                                          Sep 12 at 18:35

                                                                          That hashtable usage is clever. I’m going to need to remember that.
                                                                          – AdmBorkBork
                                                                          Sep 12 at 18:35

                                                                          @maxb – a tio.run online interpreter link for the 67 byte answer
                                                                          – TessellatingHeckler
                                                                          Sep 17 at 5:07

                                                                          @maxb – a tio.run online interpreter link for the 67 byte answer
                                                                          – TessellatingHeckler
                                                                          Sep 17 at 5:07

                                                                          1

                                                                          1

                                                                          @mazzy I can reformulate yours, but still can’t beat 67 (replace the two n with real newlines) (" YeahnBut No But Yeah ButnNo "*($j="$args")|% s*t 32)[1..$j]-ne''
                                                                          – TessellatingHeckler
                                                                          Sep 17 at 5:49

                                                                          @mazzy I can reformulate yours, but still can’t beat 67 (replace the two n with real newlines) (" YeahnBut No But Yeah ButnNo "*($j="$args")|% s*t 32)[1..$j]-ne''
                                                                          – TessellatingHeckler
                                                                          Sep 17 at 5:49

                                                                          up vote
                                                                          4
                                                                          down vote

                                                                          Haskell, 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!

                                                                          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
                                                                          

                                                                          share|improve this answer

                                                                            up vote
                                                                            4
                                                                            down vote

                                                                            Haskell, 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!

                                                                            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
                                                                            

                                                                            share|improve this answer

                                                                              up vote
                                                                              4
                                                                              down vote

                                                                              up vote
                                                                              4
                                                                              down vote

                                                                              Haskell, 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!

                                                                              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
                                                                              

                                                                              share|improve this answer

                                                                              Haskell, 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!

                                                                              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
                                                                              

                                                                              share|improve this answer

                                                                              share|improve this answer

                                                                              share|improve this answer

                                                                              edited Sep 12 at 13:49

                                                                              answered Sep 12 at 13:41

                                                                              BMO

                                                                              9,89911774

                                                                              9,89911774

                                                                                  up vote
                                                                                  4
                                                                                  down vote

                                                                                  C# (Visual C# Interactive Compiler), 105 99 94 96 89bytes

                                                                                  i=>{for(int x=0;x<i;)Write((x%3<1?"Yeahn":"")+(x%2<1?"Butn":"")+(x++%3==1?"Non":""));}
                                                                                  

                                                                                  Try it online!

                                                                                  share|improve this answer

                                                                                  • 4

                                                                                    Removing the interpolation like this saves 7 bytes.
                                                                                    – Emigna
                                                                                    Sep 12 at 10:43

                                                                                  • @Emigna Thanks for the tip, changed the answer
                                                                                    – auhmaan
                                                                                    Sep 12 at 16:33

                                                                                  • 1

                                                                                    x++%3==1? can be ++x%3>1?. Someone else just tipped it for my Java answer, but the same applies to your C# answer. 🙂
                                                                                    – Kevin Cruijssen
                                                                                    Sep 13 at 7:41

                                                                                  up vote
                                                                                  4
                                                                                  down vote

                                                                                  C# (Visual C# Interactive Compiler), 105 99 94 96 89bytes

                                                                                  i=>{for(int x=0;x<i;)Write((x%3<1?"Yeahn":"")+(x%2<1?"Butn":"")+(x++%3==1?"Non":""));}
                                                                                  

                                                                                  Try it online!

                                                                                  share|improve this answer

                                                                                  • 4

                                                                                    Removing the interpolation like this saves 7 bytes.
                                                                                    – Emigna
                                                                                    Sep 12 at 10:43

                                                                                  • @Emigna Thanks for the tip, changed the answer
                                                                                    – auhmaan
                                                                                    Sep 12 at 16:33

                                                                                  • 1

                                                                                    x++%3==1? can be ++x%3>1?. Someone else just tipped it for my Java answer, but the same applies to your C# answer. 🙂
                                                                                    – Kevin Cruijssen
                                                                                    Sep 13 at 7:41

                                                                                  up vote
                                                                                  4
                                                                                  down vote

                                                                                  up vote
                                                                                  4
                                                                                  down vote

                                                                                  C# (Visual C# Interactive Compiler), 105 99 94 96 89bytes

                                                                                  i=>{for(int x=0;x<i;)Write((x%3<1?"Yeahn":"")+(x%2<1?"Butn":"")+(x++%3==1?"Non":""));}
                                                                                  

                                                                                  Try it online!

                                                                                  share|improve this answer

                                                                                  C# (Visual C# Interactive Compiler), 105 99 94 96 89bytes

                                                                                  i=>{for(int x=0;x<i;)Write((x%3<1?"Yeahn":"")+(x%2<1?"Butn":"")+(x++%3==1?"Non":""));}
                                                                                  

                                                                                  Try it online!

                                                                                  share|improve this answer

                                                                                  share|improve this answer

                                                                                  share|improve this answer

                                                                                  edited Sep 12 at 16:32

                                                                                  answered Sep 12 at 10:22

                                                                                  auhmaan

                                                                                  85637

                                                                                  85637

                                                                                  • 4

                                                                                    Removing the interpolation like this saves 7 bytes.
                                                                                    – Emigna
                                                                                    Sep 12 at 10:43

                                                                                  • @Emigna Thanks for the tip, changed the answer
                                                                                    – auhmaan
                                                                                    Sep 12 at 16:33

                                                                                  • 1

                                                                                    x++%3==1? can be ++x%3>1?. Someone else just tipped it for my Java answer, but the same applies to your C# answer. 🙂
                                                                                    – Kevin Cruijssen
                                                                                    Sep 13 at 7:41

                                                                                  • 4

                                                                                    Removing the interpolation like this saves 7 bytes.
                                                                                    – Emigna
                                                                                    Sep 12 at 10:43

                                                                                  • @Emigna Thanks for the tip, changed the answer
                                                                                    – auhmaan
                                                                                    Sep 12 at 16:33

                                                                                  • 1

                                                                                    x++%3==1? can be ++x%3>1?. Someone else just tipped it for my Java answer, but the same applies to your C# answer. 🙂
                                                                                    – Kevin Cruijssen
                                                                                    Sep 13 at 7:41

                                                                                  4

                                                                                  4

                                                                                  Removing the interpolation like this saves 7 bytes.
                                                                                  – Emigna
                                                                                  Sep 12 at 10:43

                                                                                  Removing the interpolation like this saves 7 bytes.
                                                                                  – Emigna
                                                                                  Sep 12 at 10:43

                                                                                  @Emigna Thanks for the tip, changed the answer
                                                                                  – auhmaan
                                                                                  Sep 12 at 16:33

                                                                                  @Emigna Thanks for the tip, changed the answer
                                                                                  – auhmaan
                                                                                  Sep 12 at 16:33

                                                                                  1

                                                                                  1

                                                                                  x++%3==1? can be ++x%3>1?. Someone else just tipped it for my Java answer, but the same applies to your C# answer. 🙂
                                                                                  – Kevin Cruijssen
                                                                                  Sep 13 at 7:41

                                                                                  x++%3==1? can be ++x%3>1?. Someone else just tipped it for my Java answer, but the same applies to your C# answer. 🙂
                                                                                  – Kevin Cruijssen
                                                                                  Sep 13 at 7:41

                                                                                  up vote
                                                                                  4
                                                                                  down vote

                                                                                  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!

                                                                                  Explanation

                                                                                  This explanation is for the previous version–see below for changelog

                                                                                  Inspired by Jo King’s Perl 6 answer. 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.

                                                                                  share|improve this answer

                                                                                    up vote
                                                                                    4
                                                                                    down vote

                                                                                    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!

                                                                                    Explanation

                                                                                    This explanation is for the previous version–see below for changelog

                                                                                    Inspired by Jo King’s Perl 6 answer. 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.

                                                                                    share|improve this answer

                                                                                      up vote
                                                                                      4
                                                                                      down vote

                                                                                      up vote
                                                                                      4
                                                                                      down vote

                                                                                      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!

                                                                                      Explanation

                                                                                      This explanation is for the previous version–see below for changelog

                                                                                      Inspired by Jo King’s Perl 6 answer. 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.

                                                                                      share|improve this answer

                                                                                      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!

                                                                                      Explanation

                                                                                      This explanation is for the previous version–see below for changelog

                                                                                      Inspired by Jo King’s Perl 6 answer. 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.

                                                                                      share|improve this answer

                                                                                      share|improve this answer

                                                                                      share|improve this answer

                                                                                      edited Sep 12 at 20:37

                                                                                      answered Sep 12 at 15:09

                                                                                      DLosc

                                                                                      18.3k33588

                                                                                      18.3k33588

                                                                                          up vote
                                                                                          4
                                                                                          down vote

                                                                                          Attache, 48 bytes

                                                                                          Flat##{Mask[_%3'2'3=0'0'1,$Yeah'$But'$No]}=>Iota
                                                                                          

                                                                                          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
                                                                                          

                                                                                          share|improve this answer

                                                                                            up vote
                                                                                            4
                                                                                            down vote

                                                                                            Attache, 48 bytes

                                                                                            Flat##{Mask[_%3'2'3=0'0'1,$Yeah'$But'$No]}=>Iota
                                                                                            

                                                                                            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
                                                                                            

                                                                                            share|improve this answer

                                                                                              up vote
                                                                                              4
                                                                                              down vote

                                                                                              up vote
                                                                                              4
                                                                                              down vote

                                                                                              Attache, 48 bytes

                                                                                              Flat##{Mask[_%3'2'3=0'0'1,$Yeah'$But'$No]}=>Iota
                                                                                              

                                                                                              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
                                                                                              

                                                                                              share|improve this answer

                                                                                              Attache, 48 bytes

                                                                                              Flat##{Mask[_%3'2'3=0'0'1,$Yeah'$But'$No]}=>Iota
                                                                                              

                                                                                              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
                                                                                              

                                                                                              share|improve this answer

                                                                                              share|improve this answer

                                                                                              share|improve this answer

                                                                                              answered Sep 13 at 1:40

                                                                                              Conor O’Brien

                                                                                              28.5k262158

                                                                                              28.5k262158

                                                                                                  up vote
                                                                                                  4
                                                                                                  down vote

                                                                                                  C (gcc), 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!

                                                                                                  share|improve this answer

                                                                                                  • @JonathanFrech Nice but doesn’t work for zero, or 5
                                                                                                    – cleblanc
                                                                                                    Sep 18 at 17:04

                                                                                                  • @cleblanc Oh, sorry. Did not realize … At least removing j saved you two bytes.
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 17:46

                                                                                                  • 1

                                                                                                    70 bytes — incorporating @ceilingcat’s one saved byte.
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 18:01

                                                                                                  • 1

                                                                                                    n-~-i is equivalent to n-i+1 — not i<n+1 — and so does not actually save any bytes …
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 19:16

                                                                                                  up vote
                                                                                                  4
                                                                                                  down vote

                                                                                                  C (gcc), 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!

                                                                                                  share|improve this answer

                                                                                                  • @JonathanFrech Nice but doesn’t work for zero, or 5
                                                                                                    – cleblanc
                                                                                                    Sep 18 at 17:04

                                                                                                  • @cleblanc Oh, sorry. Did not realize … At least removing j saved you two bytes.
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 17:46

                                                                                                  • 1

                                                                                                    70 bytes — incorporating @ceilingcat’s one saved byte.
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 18:01

                                                                                                  • 1

                                                                                                    n-~-i is equivalent to n-i+1 — not i<n+1 — and so does not actually save any bytes …
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 19:16

                                                                                                  up vote
                                                                                                  4
                                                                                                  down vote

                                                                                                  up vote
                                                                                                  4
                                                                                                  down vote

                                                                                                  C (gcc), 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!

                                                                                                  share|improve this answer

                                                                                                  C (gcc), 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!

                                                                                                  share|improve this answer

                                                                                                  share|improve this answer

                                                                                                  share|improve this answer

                                                                                                  edited Sep 21 at 13:13

                                                                                                  answered Sep 13 at 20:12

                                                                                                  cleblanc

                                                                                                  3,170216

                                                                                                  3,170216

                                                                                                  • @JonathanFrech Nice but doesn’t work for zero, or 5
                                                                                                    – cleblanc
                                                                                                    Sep 18 at 17:04

                                                                                                  • @cleblanc Oh, sorry. Did not realize … At least removing j saved you two bytes.
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 17:46

                                                                                                  • 1

                                                                                                    70 bytes — incorporating @ceilingcat’s one saved byte.
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 18:01

                                                                                                  • 1

                                                                                                    n-~-i is equivalent to n-i+1 — not i<n+1 — and so does not actually save any bytes …
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 19:16

                                                                                                  • @JonathanFrech Nice but doesn’t work for zero, or 5
                                                                                                    – cleblanc
                                                                                                    Sep 18 at 17:04

                                                                                                  • @cleblanc Oh, sorry. Did not realize … At least removing j saved you two bytes.
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 17:46

                                                                                                  • 1

                                                                                                    70 bytes — incorporating @ceilingcat’s one saved byte.
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 18:01

                                                                                                  • 1

                                                                                                    n-~-i is equivalent to n-i+1 — not i<n+1 — and so does not actually save any bytes …
                                                                                                    – Jonathan Frech
                                                                                                    Sep 18 at 19:16

                                                                                                  @JonathanFrech Nice but doesn’t work for zero, or 5
                                                                                                  – cleblanc
                                                                                                  Sep 18 at 17:04

                                                                                                  @JonathanFrech Nice but doesn’t work for zero, or 5
                                                                                                  – cleblanc
                                                                                                  Sep 18 at 17:04

                                                                                                  @cleblanc Oh, sorry. Did not realize … At least removing j saved you two bytes.
                                                                                                  – Jonathan Frech
                                                                                                  Sep 18 at 17:46

                                                                                                  @cleblanc Oh, sorry. Did not realize … At least removing j saved you two bytes.
                                                                                                  – Jonathan Frech
                                                                                                  Sep 18 at 17:46

                                                                                                  1

                                                                                                  1

                                                                                                  70 bytes — incorporating @ceilingcat’s one saved byte.
                                                                                                  – Jonathan Frech
                                                                                                  Sep 18 at 18:01

                                                                                                  70 bytes — incorporating @ceilingcat’s one saved byte.
                                                                                                  – Jonathan Frech
                                                                                                  Sep 18 at 18:01

                                                                                                  1

                                                                                                  1

                                                                                                  n-~-i is equivalent to n-i+1 — not i<n+1 — and so does not actually save any bytes …
                                                                                                  – Jonathan Frech
                                                                                                  Sep 18 at 19:16

                                                                                                  n-~-i is equivalent to n-i+1 — not i<n+1 — and so does not actually save any bytes …
                                                                                                  – Jonathan Frech
                                                                                                  Sep 18 at 19:16

                                                                                                  up vote
                                                                                                  3
                                                                                                  down vote

                                                                                                  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

                                                                                                  share|improve this answer

                                                                                                    up vote
                                                                                                    3
                                                                                                    down vote

                                                                                                    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

                                                                                                    share|improve this answer

                                                                                                      up vote
                                                                                                      3
                                                                                                      down vote

                                                                                                      up vote
                                                                                                      3
                                                                                                      down vote

                                                                                                      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

                                                                                                      share|improve this 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

                                                                                                      share|improve this answer

                                                                                                      share|improve this answer

                                                                                                      share|improve this answer

                                                                                                      edited Sep 12 at 22:20

                                                                                                      answered Sep 12 at 21:57

                                                                                                      Håvard Nygård

                                                                                                      31117

                                                                                                      31117

                                                                                                          up vote
                                                                                                          3
                                                                                                          down vote

                                                                                                          Python 3, 93 bytes

                                                                                                          [print("Yeahn"*(i%3<1)+"Butn"*(i%2<1)+"Non"*(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!

                                                                                                          share|improve this answer

                                                                                                          • 1

                                                                                                            If you already have an expression you can use in a list comprehension but your list comprehension only exists to evoke that expression’s side effects, a plain for loop requires less bytes.
                                                                                                            – Jonathan Frech
                                                                                                            Sep 14 at 2:21

                                                                                                          up vote
                                                                                                          3
                                                                                                          down vote

                                                                                                          Python 3, 93 bytes

                                                                                                          [print("Yeahn"*(i%3<1)+"Butn"*(i%2<1)+"Non"*(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!

                                                                                                          share|improve this answer

                                                                                                          • 1

                                                                                                            If you already have an expression you can use in a list comprehension but your list comprehension only exists to evoke that expression’s side effects, a plain for loop requires less bytes.
                                                                                                            – Jonathan Frech
                                                                                                            Sep 14 at 2:21

                                                                                                          up vote
                                                                                                          3
                                                                                                          down vote

                                                                                                          up vote
                                                                                                          3
                                                                                                          down vote

                                                                                                          Python 3, 93 bytes

                                                                                                          [print("Yeahn"*(i%3<1)+"Butn"*(i%2<1)+"Non"*(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!

                                                                                                          share|improve this answer

                                                                                                          Python 3, 93 bytes

                                                                                                          [print("Yeahn"*(i%3<1)+"Butn"*(i%2<1)+"Non"*(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!

                                                                                                          share|improve this answer

                                                                                                          share|improve this answer

                                                                                                          share|improve this answer

                                                                                                          edited Sep 13 at 3:56

                                                                                                          Timtech

                                                                                                          11.4k13659

                                                                                                          11.4k13659

                                                                                                          answered Sep 13 at 3:50

                                                                                                          Josh B.

                                                                                                          612

                                                                                                          612

                                                                                                          • 1

                                                                                                            If you already have an expression you can use in a list comprehension but your list comprehension only exists to evoke that expression’s side effects, a plain for loop requires less bytes.
                                                                                                            – Jonathan Frech
                                                                                                            Sep 14 at 2:21

                                                                                                          • 1

                                                                                                            If you already have an expression you can use in a list comprehension but your list comprehension only exists to evoke that expression’s side effects, a plain for loop requires less bytes.
                                                                                                            – Jonathan Frech
                                                                                                            Sep 14 at 2:21

                                                                                                          1

                                                                                                          1

                                                                                                          If you already have an expression you can use in a list comprehension but your list comprehension only exists to evoke that expression’s side effects, a plain for loop requires less bytes.
                                                                                                          – Jonathan Frech
                                                                                                          Sep 14 at 2:21

                                                                                                          If you already have an expression you can use in a list comprehension but your list comprehension only exists to evoke that expression’s side effects, a plain for loop requires less bytes.
                                                                                                          – Jonathan Frech
                                                                                                          Sep 14 at 2:21

                                                                                                          up vote
                                                                                                          3
                                                                                                          down vote

                                                                                                          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)

                                                                                                          share|improve this answer

                                                                                                            up vote
                                                                                                            3
                                                                                                            down vote

                                                                                                            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)

                                                                                                            share|improve this answer

                                                                                                              up vote
                                                                                                              3
                                                                                                              down vote

                                                                                                              up vote
                                                                                                              3
                                                                                                              down vote

                                                                                                              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)

                                                                                                              share|improve this 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)

                                                                                                              share|improve this answer

                                                                                                              share|improve this answer

                                                                                                              share|improve this answer

                                                                                                              edited Sep 14 at 14:35

                                                                                                              answered Sep 14 at 14:26

                                                                                                              JDL

                                                                                                              1,235410

                                                                                                              1,235410

                                                                                                                  up vote
                                                                                                                  3
                                                                                                                  down vote

                                                                                                                  sed -E, 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(.*).-:21:;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.

                                                                                                                  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(.*).-:21:;        | 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
                                                                                                                  

                                                                                                                  share|improve this answer

                                                                                                                  • Can you add some explanations please ?
                                                                                                                    – user285259
                                                                                                                    Sep 21 at 8:30

                                                                                                                  • 1

                                                                                                                    @user285259 Done.
                                                                                                                    – hidefromkgb
                                                                                                                    Sep 21 at 13:21

                                                                                                                  up vote
                                                                                                                  3
                                                                                                                  down vote

                                                                                                                  sed -E, 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(.*).-:21:;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.

                                                                                                                  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(.*).-:21:;        | 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
                                                                                                                  

                                                                                                                  share|improve this answer

                                                                                                                  • Can you add some explanations please ?
                                                                                                                    – user285259
                                                                                                                    Sep 21 at 8:30

                                                                                                                  • 1

                                                                                                                    @user285259 Done.
                                                                                                                    – hidefromkgb
                                                                                                                    Sep 21 at 13:21

                                                                                                                  up vote
                                                                                                                  3
                                                                                                                  down vote

                                                                                                                  up vote
                                                                                                                  3
                                                                                                                  down vote

                                                                                                                  sed -E, 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(.*).-:21:;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.

                                                                                                                  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(.*).-:21:;        | 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
                                                                                                                  

                                                                                                                  share|improve this answer

                                                                                                                  sed -E, 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(.*).-:21:;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.

                                                                                                                  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(.*).-:21:;        | 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
                                                                                                                  

                                                                                                                  share|improve this answer

                                                                                                                  share|improve this answer

                                                                                                                  share|improve this answer

                                                                                                                  edited Sep 21 at 13:21

                                                                                                                  answered Sep 12 at 16:19

                                                                                                                  hidefromkgb

                                                                                                                  2214

                                                                                                                  2214

                                                                                                                  • Can you add some explanations please ?
                                                                                                                    – user285259
                                                                                                                    Sep 21 at 8:30

                                                                                                                  • 1

                                                                                                                    @user285259 Done.
                                                                                                                    – hidefromkgb
                                                                                                                    Sep 21 at 13:21

                                                                                                                  • Can you add some explanations please ?
                                                                                                                    – user285259
                                                                                                                    Sep 21 at 8:30

                                                                                                                  • 1

                                                                                                                    @user285259 Done.
                                                                                                                    – hidefromkgb
                                                                                                                    Sep 21 at 13:21

                                                                                                                  Can you add some explanations please ?
                                                                                                                  – user285259
                                                                                                                  Sep 21 at 8:30

                                                                                                                  Can you add some explanations please ?
                                                                                                                  – user285259
                                                                                                                  Sep 21 at 8:30

                                                                                                                  1

                                                                                                                  1

                                                                                                                  @user285259 Done.
                                                                                                                  – hidefromkgb
                                                                                                                  Sep 21 at 13:21

                                                                                                                  @user285259 Done.
                                                                                                                  – hidefromkgb
                                                                                                                  Sep 21 at 13:21

                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote

                                                                                                                  Clean, 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!

                                                                                                                  share|improve this answer

                                                                                                                    up vote
                                                                                                                    2
                                                                                                                    down vote

                                                                                                                    Clean, 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!

                                                                                                                    share|improve this answer

                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote

                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote

                                                                                                                      Clean, 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!

                                                                                                                      share|improve this answer

                                                                                                                      Clean, 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!

                                                                                                                      share|improve this answer

                                                                                                                      share|improve this answer

                                                                                                                      share|improve this answer

                                                                                                                      answered Sep 12 at 21:40

                                                                                                                      Οurous

                                                                                                                      5,36311031

                                                                                                                      5,36311031

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          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!

                                                                                                                          -2 bytes changing from i=0 to p-1 to i=1 to p and adjusting modulos. Apart from that, pretty straight-forward.

                                                                                                                          share|improve this answer

                                                                                                                          • 1

                                                                                                                            I get some kind of build error for the TIO link, perhaps a syntax error in the testing code?
                                                                                                                            – maxb
                                                                                                                            Sep 13 at 8:15

                                                                                                                          • Thanks for that. My original solution printed directly to the console, but then I tried returning a sequence and it turned out to be shorter by about 2 bytes. So I changed the code in the TIO but forgot to update the footer – which was still expecting the v function to print everything out.
                                                                                                                            – Ciaran_McCarthy
                                                                                                                            Sep 13 at 8:36

                                                                                                                          • 2

                                                                                                                            Shave 2 bytes with i=1 to p (and adjusting moduli, naturally). Reverse ranges are empty. 🙂
                                                                                                                            – user82031
                                                                                                                            Sep 13 at 18:16

                                                                                                                          • Nice! I’ve added that. Thanks! 🙂
                                                                                                                            – Ciaran_McCarthy
                                                                                                                            Sep 13 at 20:56

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          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!

                                                                                                                          -2 bytes changing from i=0 to p-1 to i=1 to p and adjusting modulos. Apart from that, pretty straight-forward.

                                                                                                                          share|improve this answer

                                                                                                                          • 1

                                                                                                                            I get some kind of build error for the TIO link, perhaps a syntax error in the testing code?
                                                                                                                            – maxb
                                                                                                                            Sep 13 at 8:15

                                                                                                                          • Thanks for that. My original solution printed directly to the console, but then I tried returning a sequence and it turned out to be shorter by about 2 bytes. So I changed the code in the TIO but forgot to update the footer – which was still expecting the v function to print everything out.
                                                                                                                            – Ciaran_McCarthy
                                                                                                                            Sep 13 at 8:36

                                                                                                                          • 2

                                                                                                                            Shave 2 bytes with i=1 to p (and adjusting moduli, naturally). Reverse ranges are empty. 🙂
                                                                                                                            – user82031
                                                                                                                            Sep 13 at 18:16

                                                                                                                          • Nice! I’ve added that. Thanks! 🙂
                                                                                                                            – Ciaran_McCarthy
                                                                                                                            Sep 13 at 20:56

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          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!

                                                                                                                          -2 bytes changing from i=0 to p-1 to i=1 to p and adjusting modulos. Apart from that, pretty straight-forward.

                                                                                                                          share|improve this 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!

                                                                                                                          -2 bytes changing from i=0 to p-1 to i=1 to p and adjusting modulos. Apart from that, pretty straight-forward.

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          edited Sep 13 at 20:56

                                                                                                                          answered Sep 13 at 8:11

                                                                                                                          Ciaran_McCarthy

                                                                                                                          441118

                                                                                                                          441118

                                                                                                                          • 1

                                                                                                                            I get some kind of build error for the TIO link, perhaps a syntax error in the testing code?
                                                                                                                            – maxb
                                                                                                                            Sep 13 at 8:15

                                                                                                                          • Thanks for that. My original solution printed directly to the console, but then I tried returning a sequence and it turned out to be shorter by about 2 bytes. So I changed the code in the TIO but forgot to update the footer – which was still expecting the v function to print everything out.
                                                                                                                            – Ciaran_McCarthy
                                                                                                                            Sep 13 at 8:36

                                                                                                                          • 2

                                                                                                                            Shave 2 bytes with i=1 to p (and adjusting moduli, naturally). Reverse ranges are empty. 🙂
                                                                                                                            – user82031
                                                                                                                            Sep 13 at 18:16

                                                                                                                          • Nice! I’ve added that. Thanks! 🙂
                                                                                                                            – Ciaran_McCarthy
                                                                                                                            Sep 13 at 20:56

                                                                                                                          • 1

                                                                                                                            I get some kind of build error for the TIO link, perhaps a syntax error in the testing code?
                                                                                                                            – maxb
                                                                                                                            Sep 13 at 8:15

                                                                                                                          • Thanks for that. My original solution printed directly to the console, but then I tried returning a sequence and it turned out to be shorter by about 2 bytes. So I changed the code in the TIO but forgot to update the footer – which was still expecting the v function to print everything out.
                                                                                                                            – Ciaran_McCarthy
                                                                                                                            Sep 13 at 8:36

                                                                                                                          • 2

                                                                                                                            Shave 2 bytes with i=1 to p (and adjusting moduli, naturally). Reverse ranges are empty. 🙂
                                                                                                                            – user82031
                                                                                                                            Sep 13 at 18:16

                                                                                                                          • Nice! I’ve added that. Thanks! 🙂
                                                                                                                            – Ciaran_McCarthy
                                                                                                                            Sep 13 at 20:56

                                                                                                                          1

                                                                                                                          1

                                                                                                                          I get some kind of build error for the TIO link, perhaps a syntax error in the testing code?
                                                                                                                          – maxb
                                                                                                                          Sep 13 at 8:15

                                                                                                                          I get some kind of build error for the TIO link, perhaps a syntax error in the testing code?
                                                                                                                          – maxb
                                                                                                                          Sep 13 at 8:15

                                                                                                                          Thanks for that. My original solution printed directly to the console, but then I tried returning a sequence and it turned out to be shorter by about 2 bytes. So I changed the code in the TIO but forgot to update the footer – which was still expecting the v function to print everything out.
                                                                                                                          – Ciaran_McCarthy
                                                                                                                          Sep 13 at 8:36

                                                                                                                          Thanks for that. My original solution printed directly to the console, but then I tried returning a sequence and it turned out to be shorter by about 2 bytes. So I changed the code in the TIO but forgot to update the footer – which was still expecting the v function to print everything out.
                                                                                                                          – Ciaran_McCarthy
                                                                                                                          Sep 13 at 8:36

                                                                                                                          2

                                                                                                                          2

                                                                                                                          Shave 2 bytes with i=1 to p (and adjusting moduli, naturally). Reverse ranges are empty. 🙂
                                                                                                                          – user82031
                                                                                                                          Sep 13 at 18:16

                                                                                                                          Shave 2 bytes with i=1 to p (and adjusting moduli, naturally). Reverse ranges are empty. 🙂
                                                                                                                          – user82031
                                                                                                                          Sep 13 at 18:16

                                                                                                                          Nice! I’ve added that. Thanks! 🙂
                                                                                                                          – Ciaran_McCarthy
                                                                                                                          Sep 13 at 20:56

                                                                                                                          Nice! I’ve added that. Thanks! 🙂
                                                                                                                          – Ciaran_McCarthy
                                                                                                                          Sep 13 at 20:56

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          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.

                                                                                                                          share|improve this answer

                                                                                                                          • It looks good, but it produces an extra newline in the middle for n=10
                                                                                                                            – maxb
                                                                                                                            Sep 13 at 21:02

                                                                                                                          • @maxb Thanks for the hint. I could have fixed it with 9 extra bytes; but the other approach is shorter.
                                                                                                                            – Titus
                                                                                                                            Sep 13 at 23:50

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          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.

                                                                                                                          share|improve this answer

                                                                                                                          • It looks good, but it produces an extra newline in the middle for n=10
                                                                                                                            – maxb
                                                                                                                            Sep 13 at 21:02

                                                                                                                          • @maxb Thanks for the hint. I could have fixed it with 9 extra bytes; but the other approach is shorter.
                                                                                                                            – Titus
                                                                                                                            Sep 13 at 23:50

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          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.

                                                                                                                          share|improve this 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.

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          edited Sep 13 at 23:49

                                                                                                                          answered Sep 13 at 20:23

                                                                                                                          Titus

                                                                                                                          12.5k11236

                                                                                                                          12.5k11236

                                                                                                                          • It looks good, but it produces an extra newline in the middle for n=10
                                                                                                                            – maxb
                                                                                                                            Sep 13 at 21:02

                                                                                                                          • @maxb Thanks for the hint. I could have fixed it with 9 extra bytes; but the other approach is shorter.
                                                                                                                            – Titus
                                                                                                                            Sep 13 at 23:50

                                                                                                                          • It looks good, but it produces an extra newline in the middle for n=10
                                                                                                                            – maxb
                                                                                                                            Sep 13 at 21:02

                                                                                                                          • @maxb Thanks for the hint. I could have fixed it with 9 extra bytes; but the other approach is shorter.
                                                                                                                            – Titus
                                                                                                                            Sep 13 at 23:50

                                                                                                                          It looks good, but it produces an extra newline in the middle for n=10
                                                                                                                          – maxb
                                                                                                                          Sep 13 at 21:02

                                                                                                                          It looks good, but it produces an extra newline in the middle for n=10
                                                                                                                          – maxb
                                                                                                                          Sep 13 at 21:02

                                                                                                                          @maxb Thanks for the hint. I could have fixed it with 9 extra bytes; but the other approach is shorter.
                                                                                                                          – Titus
                                                                                                                          Sep 13 at 23:50

                                                                                                                          @maxb Thanks for the hint. I could have fixed it with 9 extra bytes; but the other approach is shorter.
                                                                                                                          – Titus
                                                                                                                          Sep 13 at 23:50

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          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=i2,"","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
                                                                                                                          

                                                                                                                          share|improve this answer

                                                                                                                          • @Keeta good idea, but no… If you look at my first code, I use [a1] which means Range/cell .value 🙂 I should’ve made it more clear that was an explanation though, sorry :/
                                                                                                                            – seadoggie01
                                                                                                                            Sep 14 at 13:20

                                                                                                                          • 1

                                                                                                                            Yeah, I saw that and tried to delete the comment. How about using i/3=i3 instead of i mod 3 = 0 (and same for mod 2 = 0). Haven’t tried it, but would it work?
                                                                                                                            – Keeta
                                                                                                                            Sep 14 at 13:24

                                                                                                                          • @Keeta I’ve never seen the operator before… I don’t think so though, it returns the value of division without the remainder… like the opposite of Mod I think
                                                                                                                            – seadoggie01
                                                                                                                            Sep 14 at 13:28

                                                                                                                          • One is integer division and one is floating point. 7/3 = 2.3333 where 73 = 2 (truncate division). 6/3 should be 2, and 63 should also be 2 so it should work whenever remainder is zero (I think).
                                                                                                                            – Keeta
                                                                                                                            Sep 14 at 13:30

                                                                                                                          • 1

                                                                                                                            VBA will automatically concatenate function outputs, so you can drop the & between eachIIf(..) for an extra 2 bytes
                                                                                                                            – Chronocidal
                                                                                                                            Sep 14 at 15:40

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          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=i2,"","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
                                                                                                                          

                                                                                                                          share|improve this answer

                                                                                                                          • @Keeta good idea, but no… If you look at my first code, I use [a1] which means Range/cell .value 🙂 I should’ve made it more clear that was an explanation though, sorry :/
                                                                                                                            – seadoggie01
                                                                                                                            Sep 14 at 13:20

                                                                                                                          • 1

                                                                                                                            Yeah, I saw that and tried to delete the comment. How about using i/3=i3 instead of i mod 3 = 0 (and same for mod 2 = 0). Haven’t tried it, but would it work?
                                                                                                                            – Keeta
                                                                                                                            Sep 14 at 13:24

                                                                                                                          • @Keeta I’ve never seen the operator before… I don’t think so though, it returns the value of division without the remainder… like the opposite of Mod I think
                                                                                                                            – seadoggie01
                                                                                                                            Sep 14 at 13:28

                                                                                                                          • One is integer division and one is floating point. 7/3 = 2.3333 where 73 = 2 (truncate division). 6/3 should be 2, and 63 should also be 2 so it should work whenever remainder is zero (I think).
                                                                                                                            – Keeta
                                                                                                                            Sep 14 at 13:30

                                                                                                                          • 1

                                                                                                                            VBA will automatically concatenate function outputs, so you can drop the & between eachIIf(..) for an extra 2 bytes
                                                                                                                            – Chronocidal
                                                                                                                            Sep 14 at 15:40

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          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=i2,"","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
                                                                                                                          

                                                                                                                          share|improve this 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=i2,"","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
                                                                                                                          

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          edited Sep 14 at 15:53

                                                                                                                          answered Sep 13 at 3:18

                                                                                                                          seadoggie01

                                                                                                                          1518

                                                                                                                          1518

                                                                                                                          • @Keeta good idea, but no… If you look at my first code, I use [a1] which means Range/cell .value 🙂 I should’ve made it more clear that was an explanation though, sorry :/
                                                                                                                            – seadoggie01
                                                                                                                            Sep 14 at 13:20

                                                                                                                          • 1

                                                                                                                            Yeah, I saw that and tried to delete the comment. How about using i/3=i3 instead of i mod 3 = 0 (and same for mod 2 = 0). Haven’t tried it, but would it work?
                                                                                                                            – Keeta
                                                                                                                            Sep 14 at 13:24

                                                                                                                          • @Keeta I’ve never seen the operator before… I don’t think so though, it returns the value of division without the remainder… like the opposite of Mod I think
                                                                                                                            – seadoggie01
                                                                                                                            Sep 14 at 13:28

                                                                                                                          • One is integer division and one is floating point. 7/3 = 2.3333 where 73 = 2 (truncate division). 6/3 should be 2, and 63 should also be 2 so it should work whenever remainder is zero (I think).
                                                                                                                            – Keeta
                                                                                                                            Sep 14 at 13:30

                                                                                                                          • 1

                                                                                                                            VBA will automatically concatenate function outputs, so you can drop the & between eachIIf(..) for an extra 2 bytes
                                                                                                                            – Chronocidal
                                                                                                                            Sep 14 at 15:40

                                                                                                                          • @Keeta good idea, but no… If you look at my first code, I use [a1] which means Range/cell .value 🙂 I should’ve made it more clear that was an explanation though, sorry :/
                                                                                                                            – seadoggie01
                                                                                                                            Sep 14 at 13:20

                                                                                                                          • 1

                                                                                                                            Yeah, I saw that and tried to delete the comment. How about using i/3=i3 instead of i mod 3 = 0 (and same for mod 2 = 0). Haven’t tried it, but would it work?
                                                                                                                            – Keeta
                                                                                                                            Sep 14 at 13:24

                                                                                                                          • @Keeta I’ve never seen the operator before… I don’t think so though, it returns the value of division without the remainder… like the opposite of Mod I think
                                                                                                                            – seadoggie01
                                                                                                                            Sep 14 at 13:28

                                                                                                                          • One is integer division and one is floating point. 7/3 = 2.3333 where 73 = 2 (truncate division). 6/3 should be 2, and 63 should also be 2 so it should work whenever remainder is zero (I think).
                                                                                                                            – Keeta
                                                                                                                            Sep 14 at 13:30

                                                                                                                          • 1

                                                                                                                            VBA will automatically concatenate function outputs, so you can drop the & between eachIIf(..) for an extra 2 bytes
                                                                                                                            – Chronocidal
                                                                                                                            Sep 14 at 15:40

                                                                                                                          @Keeta good idea, but no… If you look at my first code, I use [a1] which means Range/cell .value 🙂 I should’ve made it more clear that was an explanation though, sorry :/
                                                                                                                          – seadoggie01
                                                                                                                          Sep 14 at 13:20

                                                                                                                          @Keeta good idea, but no… If you look at my first code, I use [a1] which means Range/cell .value 🙂 I should’ve made it more clear that was an explanation though, sorry :/
                                                                                                                          – seadoggie01
                                                                                                                          Sep 14 at 13:20

                                                                                                                          1

                                                                                                                          1

                                                                                                                          Yeah, I saw that and tried to delete the comment. How about using i/3=i3 instead of i mod 3 = 0 (and same for mod 2 = 0). Haven’t tried it, but would it work?
                                                                                                                          – Keeta
                                                                                                                          Sep 14 at 13:24

                                                                                                                          Yeah, I saw that and tried to delete the comment. How about using i/3=i3 instead of i mod 3 = 0 (and same for mod 2 = 0). Haven’t tried it, but would it work?
                                                                                                                          – Keeta
                                                                                                                          Sep 14 at 13:24

                                                                                                                          @Keeta I’ve never seen the operator before… I don’t think so though, it returns the value of division without the remainder… like the opposite of Mod I think
                                                                                                                          – seadoggie01
                                                                                                                          Sep 14 at 13:28

                                                                                                                          @Keeta I’ve never seen the operator before… I don’t think so though, it returns the value of division without the remainder… like the opposite of Mod I think
                                                                                                                          – seadoggie01
                                                                                                                          Sep 14 at 13:28

                                                                                                                          One is integer division and one is floating point. 7/3 = 2.3333 where 73 = 2 (truncate division). 6/3 should be 2, and 63 should also be 2 so it should work whenever remainder is zero (I think).
                                                                                                                          – Keeta
                                                                                                                          Sep 14 at 13:30

                                                                                                                          One is integer division and one is floating point. 7/3 = 2.3333 where 73 = 2 (truncate division). 6/3 should be 2, and 63 should also be 2 so it should work whenever remainder is zero (I think).
                                                                                                                          – Keeta
                                                                                                                          Sep 14 at 13:30

                                                                                                                          1

                                                                                                                          1

                                                                                                                          VBA will automatically concatenate function outputs, so you can drop the & between eachIIf(..) for an extra 2 bytes
                                                                                                                          – Chronocidal
                                                                                                                          Sep 14 at 15:40

                                                                                                                          VBA will automatically concatenate function outputs, so you can drop the & between eachIIf(..) for an extra 2 bytes
                                                                                                                          – Chronocidal
                                                                                                                          Sep 14 at 15:40

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          Jelly, 22 bytes

                                                                                                                          5Rż7FṚṁị“'⁴ÆẓNƇ»ḲŒP¤Ẏ
                                                                                                                          

                                                                                                                          A monadic Link yielding a list of lines (which seems to have been allowed in comments)

                                                                                                                          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 $2times3=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"]
                                                                                                                          

                                                                                                                          share|improve this answer

                                                                                                                          • I doubt it’s going to get any shorter than this. Fantastic answer, and a great explanation, well done!
                                                                                                                            – maxb
                                                                                                                            Sep 17 at 5:01

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          Jelly, 22 bytes

                                                                                                                          5Rż7FṚṁị“'⁴ÆẓNƇ»ḲŒP¤Ẏ
                                                                                                                          

                                                                                                                          A monadic Link yielding a list of lines (which seems to have been allowed in comments)

                                                                                                                          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 $2times3=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"]
                                                                                                                          

                                                                                                                          share|improve this answer

                                                                                                                          • I doubt it’s going to get any shorter than this. Fantastic answer, and a great explanation, well done!
                                                                                                                            – maxb
                                                                                                                            Sep 17 at 5:01

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          Jelly, 22 bytes

                                                                                                                          5Rż7FṚṁị“'⁴ÆẓNƇ»ḲŒP¤Ẏ
                                                                                                                          

                                                                                                                          A monadic Link yielding a list of lines (which seems to have been allowed in comments)

                                                                                                                          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 $2times3=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"]
                                                                                                                          

                                                                                                                          share|improve this answer

                                                                                                                          Jelly, 22 bytes

                                                                                                                          5Rż7FṚṁị“'⁴ÆẓNƇ»ḲŒP¤Ẏ
                                                                                                                          

                                                                                                                          A monadic Link yielding a list of lines (which seems to have been allowed in comments)

                                                                                                                          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 $2times3=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"]
                                                                                                                          

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          edited Sep 16 at 20:52

                                                                                                                          answered Sep 16 at 19:59

                                                                                                                          Jonathan Allan

                                                                                                                          48.6k534160

                                                                                                                          48.6k534160

                                                                                                                          • I doubt it’s going to get any shorter than this. Fantastic answer, and a great explanation, well done!
                                                                                                                            – maxb
                                                                                                                            Sep 17 at 5:01

                                                                                                                          • I doubt it’s going to get any shorter than this. Fantastic answer, and a great explanation, well done!
                                                                                                                            – maxb
                                                                                                                            Sep 17 at 5:01

                                                                                                                          I doubt it’s going to get any shorter than this. Fantastic answer, and a great explanation, well done!
                                                                                                                          – maxb
                                                                                                                          Sep 17 at 5:01

                                                                                                                          I doubt it’s going to get any shorter than this. Fantastic answer, and a great explanation, well done!
                                                                                                                          – maxb
                                                                                                                          Sep 17 at 5:01

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          Python 2, 93 92 83 bytes

                                                                                                                          lambda i:''.join('Yeahn'*(x%3<1)+'Butn'*(x%2<1)+'Non'*(x%3==1)for x in range(i))
                                                                                                                          

                                                                                                                          Try it online!

                                                                                                                          A massive 9 bytes saved with thanks to @Jonathan Frech

                                                                                                                          share|improve this answer

                                                                                                                          • You could use string repetition instead of tuple indexing — ('','Yeahn')[x%3<1] is equivalent to "Yeahn"*(x%3<1).
                                                                                                                            – Jonathan Frech
                                                                                                                            Sep 16 at 10:34

                                                                                                                          • @JonathanFrech – very cool! Similar technique can be applied to the other cases as well. Many thanks!
                                                                                                                            – ElPedro
                                                                                                                            Sep 17 at 8:10

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          Python 2, 93 92 83 bytes

                                                                                                                          lambda i:''.join('Yeahn'*(x%3<1)+'Butn'*(x%2<1)+'Non'*(x%3==1)for x in range(i))
                                                                                                                          

                                                                                                                          Try it online!

                                                                                                                          A massive 9 bytes saved with thanks to @Jonathan Frech

                                                                                                                          share|improve this answer

                                                                                                                          • You could use string repetition instead of tuple indexing — ('','Yeahn')[x%3<1] is equivalent to "Yeahn"*(x%3<1).
                                                                                                                            – Jonathan Frech
                                                                                                                            Sep 16 at 10:34

                                                                                                                          • @JonathanFrech – very cool! Similar technique can be applied to the other cases as well. Many thanks!
                                                                                                                            – ElPedro
                                                                                                                            Sep 17 at 8:10

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote

                                                                                                                          Python 2, 93 92 83 bytes

                                                                                                                          lambda i:''.join('Yeahn'*(x%3<1)+'Butn'*(x%2<1)+'Non'*(x%3==1)for x in range(i))
                                                                                                                          

                                                                                                                          Try it online!

                                                                                                                          A massive 9 bytes saved with thanks to @Jonathan Frech

                                                                                                                          share|improve this answer

                                                                                                                          Python 2, 93 92 83 bytes

                                                                                                                          lambda i:''.join('Yeahn'*(x%3<1)+'Butn'*(x%2<1)+'Non'*(x%3==1)for x in range(i))
                                                                                                                          

                                                                                                                          Try it online!

                                                                                                                          A massive 9 bytes saved with thanks to @Jonathan Frech

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          share|improve this answer

                                                                                                                          edited Sep 17 at 8:20

                                                                                                                          answered Sep 12 at 13:04

                                                                                                                          ElPedro

                                                                                                                          3,2051023

                                                                                                                          3,2051023

                                                                                                                          • You could use string repetition instead of tuple indexing — ('','Yeahn')[x%3<1] is equivalent to "Yeahn"*(x%3<1).
                                                                                                                            – Jonathan Frech
                                                                                                                            Sep 16 at 10:34

                                                                                                                          • @JonathanFrech – very cool! Similar technique can be applied to the other cases as well. Many thanks!
                                                                                                                            – ElPedro
                                                                                                                            Sep 17 at 8:10

                                                                                                                          • You could use string repetition instead of tuple indexing — ('','Yeahn')[x%3<1] is equivalent to "Yeahn"*(x%3<1).
                                                                                                                            – Jonathan Frech
                                                                                                                            Sep 16 at 10:34

                                                                                                                          • @JonathanFrech – very cool! Similar technique can be applied to the other cases as well. Many thanks!
                                                                                                                            – ElPedro
                                                                                                                            Sep 17 at 8:10

                                                                                                                          You could use string repetition instead of tuple indexing — ('','Yeahn')[x%3<1] is equivalent to "Yeahn"*(x%3<1).
                                                                                                                          – Jonathan Frech
                                                                                                                          Sep 16 at 10:34

                                                                                                                          You could use string repetition instead of tuple indexing — ('','Yeahn')[x%3<1] is equivalent to "Yeahn"*(x%3<1).
                                                                                                                          – Jonathan Frech
                                                                                                                          Sep 16 at 10:34

                                                                                                                          @JonathanFrech – very cool! Similar technique can be applied to the other cases as well. Many thanks!
                                                                                                                          – ElPedro
                                                                                                                          Sep 17 at 8:10

                                                                                                                          @JonathanFrech – very cool! Similar technique can be applied to the other cases as well. Many thanks!
                                                                                                                          – ElPedro
                                                                                                                          Sep 17 at 8:10

                                                                                                                          1 2
                                                                                                                          next

                                                                                                                           
                                                                                                                          draft saved
                                                                                                                          draft discarded

                                                                                                                           

                                                                                                                          draft saved

                                                                                                                          draft discarded

                                                                                                                          StackExchange.ready(
                                                                                                                          function () {
                                                                                                                          StackExchange.openid.initPostLogin(‘.new-post-login’, ‘https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f172036%2fyeah-but-no-but-yeah%23new-answer’, ‘question_page’);
                                                                                                                          }
                                                                                                                          );

                                                                                                                          Post as a guest

                                                                                                                          Understanding fb_imageblit struct for framebuffer’s imageblits ioctl

                                                                                                                          The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

                                                                                                                          up vote
                                                                                                                          0
                                                                                                                          down vote

                                                                                                                          favorite

                                                                                                                          I have been creating a custom framebuffer driver and had to implement XXXfb_imageblit. The function takes an fb_image struct as a parameter and
                                                                                                                          I do not understand how the image is stored in fb_image.

                                                                                                                          struct fb_image {
                                                                                                                              __u32 dx;       /* Where to place image */
                                                                                                                              __u32 dy;
                                                                                                                              __u32 width;        /* Size of image */
                                                                                                                              __u32 height;
                                                                                                                              __u32 fg_color;     /* Only used when a mono bitmap */
                                                                                                                              __u32 bg_color;
                                                                                                                              __u8  depth;        /* Depth of the image */
                                                                                                                              const char *data;   /* Pointer to image data */
                                                                                                                              struct fb_cmap cmap;    /* color map info */
                                                                                                                          };
                                                                                                                          

                                                                                                                          It is said in the comment (fb.h) that *data should have the pointer to the image data. How is the image data represented in this case?

                                                                                                                          share|improve this question

                                                                                                                          migrated from unix.stackexchange.com Sep 12 at 9:46

                                                                                                                          This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.

                                                                                                                            up vote
                                                                                                                            0
                                                                                                                            down vote

                                                                                                                            favorite

                                                                                                                            I have been creating a custom framebuffer driver and had to implement XXXfb_imageblit. The function takes an fb_image struct as a parameter and
                                                                                                                            I do not understand how the image is stored in fb_image.

                                                                                                                            struct fb_image {
                                                                                                                                __u32 dx;       /* Where to place image */
                                                                                                                                __u32 dy;
                                                                                                                                __u32 width;        /* Size of image */
                                                                                                                                __u32 height;
                                                                                                                                __u32 fg_color;     /* Only used when a mono bitmap */
                                                                                                                                __u32 bg_color;
                                                                                                                                __u8  depth;        /* Depth of the image */
                                                                                                                                const char *data;   /* Pointer to image data */
                                                                                                                                struct fb_cmap cmap;    /* color map info */
                                                                                                                            };
                                                                                                                            

                                                                                                                            It is said in the comment (fb.h) that *data should have the pointer to the image data. How is the image data represented in this case?

                                                                                                                            share|improve this question

                                                                                                                            migrated from unix.stackexchange.com Sep 12 at 9:46

                                                                                                                            This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.

                                                                                                                              up vote
                                                                                                                              0
                                                                                                                              down vote

                                                                                                                              favorite

                                                                                                                              up vote
                                                                                                                              0
                                                                                                                              down vote

                                                                                                                              favorite

                                                                                                                              I have been creating a custom framebuffer driver and had to implement XXXfb_imageblit. The function takes an fb_image struct as a parameter and
                                                                                                                              I do not understand how the image is stored in fb_image.

                                                                                                                              struct fb_image {
                                                                                                                                  __u32 dx;       /* Where to place image */
                                                                                                                                  __u32 dy;
                                                                                                                                  __u32 width;        /* Size of image */
                                                                                                                                  __u32 height;
                                                                                                                                  __u32 fg_color;     /* Only used when a mono bitmap */
                                                                                                                                  __u32 bg_color;
                                                                                                                                  __u8  depth;        /* Depth of the image */
                                                                                                                                  const char *data;   /* Pointer to image data */
                                                                                                                                  struct fb_cmap cmap;    /* color map info */
                                                                                                                              };
                                                                                                                              

                                                                                                                              It is said in the comment (fb.h) that *data should have the pointer to the image data. How is the image data represented in this case?

                                                                                                                              share|improve this question

                                                                                                                              I have been creating a custom framebuffer driver and had to implement XXXfb_imageblit. The function takes an fb_image struct as a parameter and
                                                                                                                              I do not understand how the image is stored in fb_image.

                                                                                                                              struct fb_image {
                                                                                                                                  __u32 dx;       /* Where to place image */
                                                                                                                                  __u32 dy;
                                                                                                                                  __u32 width;        /* Size of image */
                                                                                                                                  __u32 height;
                                                                                                                                  __u32 fg_color;     /* Only used when a mono bitmap */
                                                                                                                                  __u32 bg_color;
                                                                                                                                  __u8  depth;        /* Depth of the image */
                                                                                                                                  const char *data;   /* Pointer to image data */
                                                                                                                                  struct fb_cmap cmap;    /* color map info */
                                                                                                                              };
                                                                                                                              

                                                                                                                              It is said in the comment (fb.h) that *data should have the pointer to the image data. How is the image data represented in this case?

                                                                                                                              linux kernel driver framebuffer

                                                                                                                              share|improve this question

                                                                                                                              share|improve this question

                                                                                                                              share|improve this question

                                                                                                                              share|improve this question

                                                                                                                              asked Sep 11 at 23:49

                                                                                                                              Angelo Charl

                                                                                                                              709

                                                                                                                              709

                                                                                                                              migrated from unix.stackexchange.com Sep 12 at 9:46

                                                                                                                              This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.

                                                                                                                              migrated from unix.stackexchange.com Sep 12 at 9:46

                                                                                                                              This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.

                                                                                                                                  active

                                                                                                                                  oldest

                                                                                                                                  votes

                                                                                                                                  Your Answer

                                                                                                                                  StackExchange.ifUsing(“editor”, function () {
                                                                                                                                  StackExchange.using(“externalEditor”, function () {
                                                                                                                                  StackExchange.using(“snippets”, function () {
                                                                                                                                  StackExchange.snippets.init();
                                                                                                                                  });
                                                                                                                                  });
                                                                                                                                  }, “code-snippets”);

                                                                                                                                  StackExchange.ready(function() {
                                                                                                                                  var channelOptions = {
                                                                                                                                  tags: “”.split(” “),
                                                                                                                                  id: “1”
                                                                                                                                  };
                                                                                                                                  initTagRenderer(“”.split(” “), “”.split(” “), channelOptions);

                                                                                                                                  StackExchange.using(“externalEditor”, function() {
                                                                                                                                  // Have to fire editor after snippets, if snippets enabled
                                                                                                                                  if (StackExchange.settings.snippets.snippetsEnabled) {
                                                                                                                                  StackExchange.using(“snippets”, function() {
                                                                                                                                  createEditor();
                                                                                                                                  });
                                                                                                                                  }
                                                                                                                                  else {
                                                                                                                                  createEditor();
                                                                                                                                  }
                                                                                                                                  });

                                                                                                                                  function createEditor() {
                                                                                                                                  StackExchange.prepareEditor({
                                                                                                                                  heartbeatType: ‘answer’,
                                                                                                                                  convertImagesToLinks: true,
                                                                                                                                  noModals: false,
                                                                                                                                  showLowRepImageUploadWarning: true,
                                                                                                                                  reputationToPostImages: 10,
                                                                                                                                  bindNavPrevention: true,
                                                                                                                                  postfix: “”,
                                                                                                                                  onDemand: true,
                                                                                                                                  discardSelector: “.discard-answer”
                                                                                                                                  ,immediatelyShowMarkdownHelp:true
                                                                                                                                  });

                                                                                                                                  }
                                                                                                                                  });

                                                                                                                                   
                                                                                                                                  draft saved
                                                                                                                                  draft discarded

                                                                                                                                  StackExchange.ready(
                                                                                                                                  function () {
                                                                                                                                  StackExchange.openid.initPostLogin(‘.new-post-login’, ‘https%3a%2f%2fstackoverflow.com%2fquestions%2f52292201%2funderstanding-fb-imageblit-struct-for-framebuffers-imageblits-ioctl%23new-answer’, ‘question_page’);
                                                                                                                                  }
                                                                                                                                  );

                                                                                                                                  Post as a guest

                                                                                                                                  active

                                                                                                                                  oldest

                                                                                                                                  votes

                                                                                                                                  active

                                                                                                                                  oldest

                                                                                                                                  votes

                                                                                                                                  active

                                                                                                                                  oldest

                                                                                                                                  votes

                                                                                                                                  active

                                                                                                                                  oldest

                                                                                                                                  votes

                                                                                                                                   
                                                                                                                                  draft saved
                                                                                                                                  draft discarded

                                                                                                                                   

                                                                                                                                  draft saved

                                                                                                                                  draft discarded

                                                                                                                                  StackExchange.ready(
                                                                                                                                  function () {
                                                                                                                                  StackExchange.openid.initPostLogin(‘.new-post-login’, ‘https%3a%2f%2fstackoverflow.com%2fquestions%2f52292201%2funderstanding-fb-imageblit-struct-for-framebuffers-imageblits-ioctl%23new-answer’, ‘question_page’);
                                                                                                                                  }
                                                                                                                                  );

                                                                                                                                  Post as a guest

                                                                                                                                  Removing control chars (including console codes / colours) from script output

                                                                                                                                  The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

                                                                                                                                  up vote
                                                                                                                                  60
                                                                                                                                  down vote

                                                                                                                                  favorite

                                                                                                                                  22

                                                                                                                                  I can use the “script” command to record an interactive session at the command line. However, this includes all control characters and colour codes. I can remove control characters (like backspace) with “col -b”, but I can’t find a simple way to remove the colour codes.

                                                                                                                                  Note that I want to use the command line in the normal way, so don’t want to disable colours there – I just want to remove them from the script output. Also, I know can play around and try find a regexp to fix things up, but I am hoping there is a simpler (and more reliable – what if there’s a code I don’t know about when I develop the regexp?) solution.

                                                                                                                                  To show the problem:

                                                                                                                                  spl62 tmp: script
                                                                                                                                  Script started, file is typescript
                                                                                                                                  spl62 lepl: ls
                                                                                                                                  add-licence.sed  build-example.sh  commit-test         push-docs.sh
                                                                                                                                  add-licence.sh   build.sh          delete-licence.sed  setup.py
                                                                                                                                  asn              build-test.sh     delete-licence.sh   src
                                                                                                                                  build-doc.sh     clean             doc-src             test.ini
                                                                                                                                  spl62 lepl: exit
                                                                                                                                  Script done, file is typescript
                                                                                                                                  spl62 tmp: cat -v typescript
                                                                                                                                  Script started on Thu 09 Jun 2011 09:47:27 AM CLT
                                                                                                                                  spl62 lepl: ls^M
                                                                                                                                  ^[[0m^[[00madd-licence.sed^[[0m  ^[[00;32mbuild-example.sh^[[0m  ^[[00mcommit-test^[[0m         ^[[00;32mpush-docs.sh^[[0m^M
                                                                                                                                  ^[[00;32madd-licence.sh^[[0m   ^[[00;32mbuild.sh^[[0m          ^[[00mdelete-licence.sed^[[0m  ^[[00msetup.py^[[0m^M
                                                                                                                                  ^[[01;34masn^[[0m              ^[[00;32mbuild-test.sh^[[0m     ^[[00;32mdelete-licence.sh^[[0m   ^[[01;34msrc^[[0m^M
                                                                                                                                  ^[[00;32mbuild-doc.sh^[[0m     ^[[00;32mclean^[[0m             ^[[01;34mdoc-src^[[0m             ^[[00mtest.ini^[[0m^M
                                                                                                                                  spl62 lepl: exit^M
                                                                                                                                  
                                                                                                                                  Script done on Thu 09 Jun 2011 09:47:29 AM CLT
                                                                                                                                  spl62 tmp: col -b < typescript 
                                                                                                                                  Script started on Thu 09 Jun 2011 09:47:27 AM CLT
                                                                                                                                  spl62 lepl: ls
                                                                                                                                  0m00madd-licence.sed0m  00;32mbuild-example.sh0m  00mcommit-test0m         00;32mpush-docs.sh0m
                                                                                                                                  00;32madd-licence.sh0m   00;32mbuild.sh0m          00mdelete-licence.sed0m  00msetup.py0m
                                                                                                                                  01;34masn0m              00;32mbuild-test.sh0m     00;32mdelete-licence.sh0m   01;34msrc0m
                                                                                                                                  00;32mbuild-doc.sh0m     00;32mclean0m             01;34mdoc-src0m             00mtest.ini0m
                                                                                                                                  spl62 lepl: exit
                                                                                                                                  
                                                                                                                                  Script done on Thu 09 Jun 2011 09:47:29 AM CLT
                                                                                                                                  

                                                                                                                                  share|improve this question

                                                                                                                                    up vote
                                                                                                                                    60
                                                                                                                                    down vote

                                                                                                                                    favorite

                                                                                                                                    22

                                                                                                                                    I can use the “script” command to record an interactive session at the command line. However, this includes all control characters and colour codes. I can remove control characters (like backspace) with “col -b”, but I can’t find a simple way to remove the colour codes.

                                                                                                                                    Note that I want to use the command line in the normal way, so don’t want to disable colours there – I just want to remove them from the script output. Also, I know can play around and try find a regexp to fix things up, but I am hoping there is a simpler (and more reliable – what if there’s a code I don’t know about when I develop the regexp?) solution.

                                                                                                                                    To show the problem:

                                                                                                                                    spl62 tmp: script
                                                                                                                                    Script started, file is typescript
                                                                                                                                    spl62 lepl: ls
                                                                                                                                    add-licence.sed  build-example.sh  commit-test         push-docs.sh
                                                                                                                                    add-licence.sh   build.sh          delete-licence.sed  setup.py
                                                                                                                                    asn              build-test.sh     delete-licence.sh   src
                                                                                                                                    build-doc.sh     clean             doc-src             test.ini
                                                                                                                                    spl62 lepl: exit
                                                                                                                                    Script done, file is typescript
                                                                                                                                    spl62 tmp: cat -v typescript
                                                                                                                                    Script started on Thu 09 Jun 2011 09:47:27 AM CLT
                                                                                                                                    spl62 lepl: ls^M
                                                                                                                                    ^[[0m^[[00madd-licence.sed^[[0m  ^[[00;32mbuild-example.sh^[[0m  ^[[00mcommit-test^[[0m         ^[[00;32mpush-docs.sh^[[0m^M
                                                                                                                                    ^[[00;32madd-licence.sh^[[0m   ^[[00;32mbuild.sh^[[0m          ^[[00mdelete-licence.sed^[[0m  ^[[00msetup.py^[[0m^M
                                                                                                                                    ^[[01;34masn^[[0m              ^[[00;32mbuild-test.sh^[[0m     ^[[00;32mdelete-licence.sh^[[0m   ^[[01;34msrc^[[0m^M
                                                                                                                                    ^[[00;32mbuild-doc.sh^[[0m     ^[[00;32mclean^[[0m             ^[[01;34mdoc-src^[[0m             ^[[00mtest.ini^[[0m^M
                                                                                                                                    spl62 lepl: exit^M
                                                                                                                                    
                                                                                                                                    Script done on Thu 09 Jun 2011 09:47:29 AM CLT
                                                                                                                                    spl62 tmp: col -b < typescript 
                                                                                                                                    Script started on Thu 09 Jun 2011 09:47:27 AM CLT
                                                                                                                                    spl62 lepl: ls
                                                                                                                                    0m00madd-licence.sed0m  00;32mbuild-example.sh0m  00mcommit-test0m         00;32mpush-docs.sh0m
                                                                                                                                    00;32madd-licence.sh0m   00;32mbuild.sh0m          00mdelete-licence.sed0m  00msetup.py0m
                                                                                                                                    01;34masn0m              00;32mbuild-test.sh0m     00;32mdelete-licence.sh0m   01;34msrc0m
                                                                                                                                    00;32mbuild-doc.sh0m     00;32mclean0m             01;34mdoc-src0m             00mtest.ini0m
                                                                                                                                    spl62 lepl: exit
                                                                                                                                    
                                                                                                                                    Script done on Thu 09 Jun 2011 09:47:29 AM CLT
                                                                                                                                    

                                                                                                                                    share|improve this question

                                                                                                                                      up vote
                                                                                                                                      60
                                                                                                                                      down vote

                                                                                                                                      favorite

                                                                                                                                      22

                                                                                                                                      up vote
                                                                                                                                      60
                                                                                                                                      down vote

                                                                                                                                      favorite

                                                                                                                                      22
                                                                                                                                      22

                                                                                                                                      I can use the “script” command to record an interactive session at the command line. However, this includes all control characters and colour codes. I can remove control characters (like backspace) with “col -b”, but I can’t find a simple way to remove the colour codes.

                                                                                                                                      Note that I want to use the command line in the normal way, so don’t want to disable colours there – I just want to remove them from the script output. Also, I know can play around and try find a regexp to fix things up, but I am hoping there is a simpler (and more reliable – what if there’s a code I don’t know about when I develop the regexp?) solution.

                                                                                                                                      To show the problem:

                                                                                                                                      spl62 tmp: script
                                                                                                                                      Script started, file is typescript
                                                                                                                                      spl62 lepl: ls
                                                                                                                                      add-licence.sed  build-example.sh  commit-test         push-docs.sh
                                                                                                                                      add-licence.sh   build.sh          delete-licence.sed  setup.py
                                                                                                                                      asn              build-test.sh     delete-licence.sh   src
                                                                                                                                      build-doc.sh     clean             doc-src             test.ini
                                                                                                                                      spl62 lepl: exit
                                                                                                                                      Script done, file is typescript
                                                                                                                                      spl62 tmp: cat -v typescript
                                                                                                                                      Script started on Thu 09 Jun 2011 09:47:27 AM CLT
                                                                                                                                      spl62 lepl: ls^M
                                                                                                                                      ^[[0m^[[00madd-licence.sed^[[0m  ^[[00;32mbuild-example.sh^[[0m  ^[[00mcommit-test^[[0m         ^[[00;32mpush-docs.sh^[[0m^M
                                                                                                                                      ^[[00;32madd-licence.sh^[[0m   ^[[00;32mbuild.sh^[[0m          ^[[00mdelete-licence.sed^[[0m  ^[[00msetup.py^[[0m^M
                                                                                                                                      ^[[01;34masn^[[0m              ^[[00;32mbuild-test.sh^[[0m     ^[[00;32mdelete-licence.sh^[[0m   ^[[01;34msrc^[[0m^M
                                                                                                                                      ^[[00;32mbuild-doc.sh^[[0m     ^[[00;32mclean^[[0m             ^[[01;34mdoc-src^[[0m             ^[[00mtest.ini^[[0m^M
                                                                                                                                      spl62 lepl: exit^M
                                                                                                                                      
                                                                                                                                      Script done on Thu 09 Jun 2011 09:47:29 AM CLT
                                                                                                                                      spl62 tmp: col -b < typescript 
                                                                                                                                      Script started on Thu 09 Jun 2011 09:47:27 AM CLT
                                                                                                                                      spl62 lepl: ls
                                                                                                                                      0m00madd-licence.sed0m  00;32mbuild-example.sh0m  00mcommit-test0m         00;32mpush-docs.sh0m
                                                                                                                                      00;32madd-licence.sh0m   00;32mbuild.sh0m          00mdelete-licence.sed0m  00msetup.py0m
                                                                                                                                      01;34masn0m              00;32mbuild-test.sh0m     00;32mdelete-licence.sh0m   01;34msrc0m
                                                                                                                                      00;32mbuild-doc.sh0m     00;32mclean0m             01;34mdoc-src0m             00mtest.ini0m
                                                                                                                                      spl62 lepl: exit
                                                                                                                                      
                                                                                                                                      Script done on Thu 09 Jun 2011 09:47:29 AM CLT
                                                                                                                                      

                                                                                                                                      share|improve this question

                                                                                                                                      I can use the “script” command to record an interactive session at the command line. However, this includes all control characters and colour codes. I can remove control characters (like backspace) with “col -b”, but I can’t find a simple way to remove the colour codes.

                                                                                                                                      Note that I want to use the command line in the normal way, so don’t want to disable colours there – I just want to remove them from the script output. Also, I know can play around and try find a regexp to fix things up, but I am hoping there is a simpler (and more reliable – what if there’s a code I don’t know about when I develop the regexp?) solution.

                                                                                                                                      To show the problem:

                                                                                                                                      spl62 tmp: script
                                                                                                                                      Script started, file is typescript
                                                                                                                                      spl62 lepl: ls
                                                                                                                                      add-licence.sed  build-example.sh  commit-test         push-docs.sh
                                                                                                                                      add-licence.sh   build.sh          delete-licence.sed  setup.py
                                                                                                                                      asn              build-test.sh     delete-licence.sh   src
                                                                                                                                      build-doc.sh     clean             doc-src             test.ini
                                                                                                                                      spl62 lepl: exit
                                                                                                                                      Script done, file is typescript
                                                                                                                                      spl62 tmp: cat -v typescript
                                                                                                                                      Script started on Thu 09 Jun 2011 09:47:27 AM CLT
                                                                                                                                      spl62 lepl: ls^M
                                                                                                                                      ^[[0m^[[00madd-licence.sed^[[0m  ^[[00;32mbuild-example.sh^[[0m  ^[[00mcommit-test^[[0m         ^[[00;32mpush-docs.sh^[[0m^M
                                                                                                                                      ^[[00;32madd-licence.sh^[[0m   ^[[00;32mbuild.sh^[[0m          ^[[00mdelete-licence.sed^[[0m  ^[[00msetup.py^[[0m^M
                                                                                                                                      ^[[01;34masn^[[0m              ^[[00;32mbuild-test.sh^[[0m     ^[[00;32mdelete-licence.sh^[[0m   ^[[01;34msrc^[[0m^M
                                                                                                                                      ^[[00;32mbuild-doc.sh^[[0m     ^[[00;32mclean^[[0m             ^[[01;34mdoc-src^[[0m             ^[[00mtest.ini^[[0m^M
                                                                                                                                      spl62 lepl: exit^M
                                                                                                                                      
                                                                                                                                      Script done on Thu 09 Jun 2011 09:47:29 AM CLT
                                                                                                                                      spl62 tmp: col -b < typescript 
                                                                                                                                      Script started on Thu 09 Jun 2011 09:47:27 AM CLT
                                                                                                                                      spl62 lepl: ls
                                                                                                                                      0m00madd-licence.sed0m  00;32mbuild-example.sh0m  00mcommit-test0m         00;32mpush-docs.sh0m
                                                                                                                                      00;32madd-licence.sh0m   00;32mbuild.sh0m          00mdelete-licence.sed0m  00msetup.py0m
                                                                                                                                      01;34masn0m              00;32mbuild-test.sh0m     00;32mdelete-licence.sh0m   01;34msrc0m
                                                                                                                                      00;32mbuild-doc.sh0m     00;32mclean0m             01;34mdoc-src0m             00mtest.ini0m
                                                                                                                                      spl62 lepl: exit
                                                                                                                                      
                                                                                                                                      Script done on Thu 09 Jun 2011 09:47:29 AM CLT
                                                                                                                                      

                                                                                                                                      text-processing terminal colors escape-characters typescript

                                                                                                                                      share|improve this question

                                                                                                                                      share|improve this question

                                                                                                                                      share|improve this question

                                                                                                                                      share|improve this question