Post History
Java (JDK), 311 301 296 bytes interface A{static void main(String[]x){String a=" bottle",b=" of beer",c=" on the wall. ",e;for(int i=99;i>0;i--){e=i>1?"s":"";System.out.println(i+a+e+b+c+(...
Answer
#5: Post edited
# [Java (JDK)], <s>311</s> 301 bytes- <!-- language-all: lang-java -->
interface A{static void main(String[]x){String a=" bottle",b=" of beer",c=" on the wall. ";for(int i=99;i>0;i--){var e=i!=1?"s":"";System.out.println(i+a+e+b+c+(i)+a+e+b+(i!=1?".Take one down and pass it around. ":".Go to the store and buy some more. ")+(i!=1?i-1:99)+a+(i!=2?"s":"")+b+c+"");}}}[Try it online!][TIO-kuqs3xy7]- This shortened `if-else` condition thingy is actually pretty good.
- [Java (JDK)]: http://jdk.java.net/
[TIO-kuqs3xy7]: https://tio.run/##LY7BboNADER/xd0TKwJqegNEq576Aemt6cGA0zqB3WjXkEaIb6cL4TZjjefNGQdMzs1lntkIuRPWBO@jFxSuYbDcQIdsooM4Nj9f3396fEjAUkFlRVpSuypoe4KKyKldvRgD8ktww7ZNQRUn66JQD1xmWcGvzwUniR4HdEAlP5X7N@VVrlRxuHuhLrW9pNcAkdZEHGNMcRXXccR609HjJz2aT7xQgBE09mYATQNX9B5YAJ3tTRPg@ZL7sCB2neTFOlqTVX8HbzuCLlxCUG@9nOzzLFtYi3/Ztul1gzoapYtpmub5Hw "Java (JDK) – Try It Online"
- # [Java (JDK)], <s>311</s> <s>301</s> 296 bytes
- <!-- language-all: lang-java -->
- interface A{static void main(String[]x){String a=" bottle",b=" of beer",c=" on the wall. ",e;for(int i=99;i>0;i--){e=i>1?"s":"";System.out.println(i+a+e+b+c+(i)+a+e+b+(i>1?".
- Take one down and pass it around. ":".
- Go to the store and buy some more. ")+(i>1?i-1:99)+a+(i!=2?"s":"")+b+c+"
- ");}}}
- [Try it online!][TIO-kvrkcs0v]
- This shortened `if-else` condition thingy is actually pretty good.
- [Java (JDK)]: http://jdk.java.net/
- [TIO-kvrkcs0v]: https://tio.run/##LY7LboNADEV/xZ3VIB5qugNEqq76Aemu6cKAkzqBmWjGJI0Q304Hkt21dexzT3jF9NSe55mNkDtgQ/AxekHhBq6WW@iRjd6JY3P8/vmLxkcErBTUVqQjldQh2wPURE4lzTIYkF@CG3ZdBiqh8mCdDgLgKs9L3r6WnKbRSBVvN@/Kq0Kpcnf3Qn1mB8kuwSCd0RxjTHEdN7Hm6Jn1epLtzReeKYgIWnszgKaFC3oPLIDODqYN4mLhPi2IXet4sY5Wsh7u4G1P0IdNAKPHW043RZ4vJs0v1duzWbQ2UHujonKapnn@Bw "Java (JDK) – Try It Online"
#4: Post edited
# [Java (JDK)], 311 bytes- <!-- language-all: lang-java -->
interface A{static void main(String[]x){String a=" bottles",b=" of beer",c=" on the wall. ",d=a;for(int i=99;i>0;i--){if(i<3){d=" bottle";}if(i<2){a=d;d+="s";}System.out.println(i+a+b+c+(i)+a+b+(i!=1?".Take one down and pass it around. ":".Go to the store and buy some more. ")+(i!=1?i-1:99)+d+b+c+"");}}}[Try it online!][TIO-kuqrodty]- This shortened `if-else` condition thingy is actually pretty good.
- [Java (JDK)]: http://jdk.java.net/
[TIO-kuqrodty]: https://tio.run/##PY7BTsMwEER/ZfEplpuIwik1AXHiA8qNctjETtk2sSt701JF@fbgBsRtZjSaeQc8Y34wx3kmxza02Fh4HSMjUwNnTwZ6JJdtOZDbf3x@y/FXAlYCas/c2ShWdTK@hdraIFbNzTjgLwsX7LoCxMpUqFsfsvQBVJWlpud7TXkuR2ozenqUo/mfE3pawgc5YmW0UZWIKdteI9u@8AMXpwTAnctIoapVozKSi8rorlq/iGLn3vFoE4MF4y8O0Bk4YYxADBj84Exi2tx6bx7YL6SRfbBLsx6uEH1voU9JKsq/XcrXm7KUyiyfYueE1NM0zfMP "Java (JDK) – Try It Online"
- # [Java (JDK)], <s>311</s> 301 bytes
- <!-- language-all: lang-java -->
- interface A{static void main(String[]x){String a=" bottle",b=" of beer",c=" on the wall. ";for(int i=99;i>0;i--){var e=i!=1?"s":"";System.out.println(i+a+e+b+c+(i)+a+e+b+(i!=1?".
- Take one down and pass it around. ":".
- Go to the store and buy some more. ")+(i!=1?i-1:99)+a+(i!=2?"s":"")+b+c+"
- ");}}}
- [Try it online!][TIO-kuqs3xy7]
- This shortened `if-else` condition thingy is actually pretty good.
- [Java (JDK)]: http://jdk.java.net/
- [TIO-kuqs3xy7]: https://tio.run/##LY7BboNADER/xd0TKwJqegNEq576Aemt6cGA0zqB3WjXkEaIb6cL4TZjjefNGQdMzs1lntkIuRPWBO@jFxSuYbDcQIdsooM4Nj9f3396fEjAUkFlRVpSuypoe4KKyKldvRgD8ktww7ZNQRUn66JQD1xmWcGvzwUniR4HdEAlP5X7N@VVrlRxuHuhLrW9pNcAkdZEHGNMcRXXccR609HjJz2aT7xQgBE09mYATQNX9B5YAJ3tTRPg@ZL7sCB2neTFOlqTVX8HbzuCLlxCUG@9nOzzLFtYi3/Ztul1gzoapYtpmub5Hw "Java (JDK) – Try It Online"
#3: Post edited
# [Java (JDK)], 307 bytes- <!-- language-all: lang-java -->
interface A{static void main(String[]x){String a=" bottles",b=" of beer",c=" on the wall. ",d=a;for(int i=99;i>0;i--){if(i<3){d=" bottle";}if(i<2){d+="s";}System.out.println(i+a+b+c+(i)+a+b+(i!=1?".Take one down and pass it around. ":".Go to the store and buy some more. ")+(i!=1?i-1:99)+d+b+c+"");}}}[Try it online!][TIO-kupxckci]- This shortened `if-else` condition thingy is actually pretty good.
- [Java (JDK)]: http://jdk.java.net/
[TIO-kupxckci]: https://tio.run/##PY7BTsMwEER/ZfHJlpuIwikNAXHiA8qNctjETtk2sSt701JF@fbgBsRtZjSaNwc8Y3Ywx3kmxza02Fh4HSMjUwNnTwZ6JCe3HMjtPz6/1fgrASsBtWfubBSrOhnfQm1tEKvmZhzwl4ULdl0OYmUqLFsfZGIAVUVR0vN9SVmmRmolPT2q0fzPiXJawocU6krE5LfXyLbP/cD5KcG5c5I06lo3WpJalKS7av0i8p17x6NNfAvGXxygM3DCGIEYMPjBmfRnc@u9eWC/vIzsg12a9XCF6HsLfUpSUf3tUrbeFIXSZmGKnROqnKZpnn8A "Java (JDK) – Try It Online"
- # [Java (JDK)], 311 bytes
- <!-- language-all: lang-java -->
- interface A{static void main(String[]x){String a=" bottles",b=" of beer",c=" on the wall. ",d=a;for(int i=99;i>0;i--){if(i<3){d=" bottle";}if(i<2){a=d;d+="s";}System.out.println(i+a+b+c+(i)+a+b+(i!=1?".
- Take one down and pass it around. ":".
- Go to the store and buy some more. ")+(i!=1?i-1:99)+d+b+c+"
- ");}}}
- [Try it online!][TIO-kuqrodty]
- This shortened `if-else` condition thingy is actually pretty good.
- [Java (JDK)]: http://jdk.java.net/
- [TIO-kuqrodty]: https://tio.run/##PY7BTsMwEER/ZfEplpuIwik1AXHiA8qNctjETtk2sSt701JF@fbgBsRtZjSaeQc8Y34wx3kmxza02Fh4HSMjUwNnTwZ6JJdtOZDbf3x@y/FXAlYCas/c2ShWdTK@hdraIFbNzTjgLwsX7LoCxMpUqFsfsvQBVJWlpud7TXkuR2ozenqUo/mfE3pawgc5YmW0UZWIKdteI9u@8AMXpwTAnctIoapVozKSi8rorlq/iGLn3vFoE4MF4y8O0Bk4YYxADBj84Exi2tx6bx7YL6SRfbBLsx6uEH1voU9JKsq/XcrXm7KUyiyfYueE1NM0zfMP "Java (JDK) – Try It Online"
#2: Post edited
# [Java (JDK)], 311 bytes- <!-- language-all: lang-java -->
interface A{static void main(String[] args){String a=" bottles",b=" of beer",c=" on the wall. ",d=a;for(int i=99;i>0;i--){if(i<3){d=" bottle";}if(i<2){d+="s";}System.out.println(i+a+b+c+(i)+a+b+(i!=1?".Take one down and pass it around. ":".Go to the store and buy some more. ")+(i!=1?i-1:99)+d+b+c+"");}}}[Try it online!][TIO-kupxaxax]- This shortened `if-else` condition thingy is actually pretty good.
- [Java (JDK)]: http://jdk.java.net/
[TIO-kupxaxax]: https://tio.run/##PY5BTsMwEEWvMnhly01EYZWGgFhxgLKjLCax006b2JU9aVVFOXtwA2I37@tr3j/iBbOjOc0zObahxcbC@xgZmRq4eDLQIzm55UBu//UNGPZRjb8IWAmoPXNno1jVCXwLtbVBrJo7OOCDhSt2XQ5iZSosWx9k8gBVRVHS62NJWaZGaiW9PKvR/L8T5bSETynUlYiJt7fIts/9wPk5yblzkjTqWjdaklouSQ/V@k3kO/eJJ5v8Foy/OkBn4IwxAnHa7wdn0p7Nvffhgf2yMrIPdmnWww2i7y30KUlF9feXsvWmKJQ2i1PsnFDlNE3z/AM "Java (JDK) – Try It Online"
- # [Java (JDK)], 307 bytes
- <!-- language-all: lang-java -->
- interface A{static void main(String[]x){String a=" bottles",b=" of beer",c=" on the wall. ",d=a;for(int i=99;i>0;i--){if(i<3){d=" bottle";}if(i<2){d+="s";}System.out.println(i+a+b+c+(i)+a+b+(i!=1?".
- Take one down and pass it around. ":".
- Go to the store and buy some more. ")+(i!=1?i-1:99)+d+b+c+"
- ");}}}
- [Try it online!][TIO-kupxckci]
- This shortened `if-else` condition thingy is actually pretty good.
- [Java (JDK)]: http://jdk.java.net/
- [TIO-kupxckci]: https://tio.run/##PY7BTsMwEER/ZfHJlpuIwikNAXHiA8qNctjETtk2sSt701JF@fbgBsRtZjSaNwc8Y3Ywx3kmxza02Fh4HSMjUwNnTwZ6JCe3HMjtPz6/1fgrASsBtWfubBSrOhnfQm1tEKvmZhzwl4ULdl0OYmUqLFsfZGIAVUVR0vN9SVmmRmolPT2q0fzPiXJawocU6krE5LfXyLbP/cD5KcG5c5I06lo3WpJalKS7av0i8p17x6NNfAvGXxygM3DCGIEYMPjBmfRnc@u9eWC/vIzsg12a9XCF6HsLfUpSUf3tUrbeFIXSZmGKnROqnKZpnn8A "Java (JDK) – Try It Online"
#1: Initial revision
# [Java (JDK)], 311 bytes <!-- language-all: lang-java --> interface A{static void main(String[] args){String a=" bottles",b=" of beer",c=" on the wall. ",d=a;for(int i=99;i>0;i--){if(i<3){d=" bottle";}if(i<2){d+="s";}System.out.println(i+a+b+c+(i)+a+b+(i!=1?".\nTake one down and pass it around. ":".\nGo to the store and buy some more. ")+(i!=1?i-1:99)+d+b+c+"\n");}}} [Try it online!][TIO-kupxaxax] This shortened `if-else` condition thingy is actually pretty good. [Java (JDK)]: http://jdk.java.net/ [TIO-kupxaxax]: https://tio.run/##PY5BTsMwEEWvMnhly01EYZWGgFhxgLKjLCax006b2JU9aVVFOXtwA2I37@tr3j/iBbOjOc0zObahxcbC@xgZmRq4eDLQIzm55UBu//UNGPZRjb8IWAmoPXNno1jVCXwLtbVBrJo7OOCDhSt2XQ5iZSosWx9k8gBVRVHS62NJWaZGaiW9PKvR/L8T5bSETynUlYiJt7fIts/9wPk5yblzkjTqWjdaklouSQ/V@k3kO/eJJ5v8Foy/OkBn4IwxAnHa7wdn0p7Nvffhgf2yMrIPdmnWww2i7y30KUlF9feXsvWmKJQ2i1PsnFDlNE3z/AM "Java (JDK) – Try It Online"